title: duplicate a mysql database using the command line
body: <p>I'd like to duplicate a mysql database I've named <code>db1</code> using the command line. In doing so, I'd like to grab all the tables and fields from <code>db1</code>, but not its values.</p>
  
  <p>I've seen many SO Q&amp;A on this topic. For example, <a href="https://stackoverflow.com/questions/25794/mysql-copy-duplicate-database">Copy/duplicate database without using mysqldump</a>.
  Unfortunately, I'm unable to accomplish two-step process suggested in this link:</p>
  
  <ol>
  <li>create database</li>
  <li>mysqldump from db1 to db2</li>
  </ol>
  
  <p>here's my code starting at bash terminal:</p>
  
  <pre><code>ubuntu@ip-xx-xxx-xxx-xx:~$ sudo -i
  root@ip-xx-xxx-xxx-xx:~# mysql -h mysite.com -u timpeterson -p
  Enter password: 
  mysql&gt; create database `db2`;
  ERROR 1044 (42000): Access denied for user 'timpeterson'@'%' to database 'db2'
  </code></pre>
  
  <p>It seems worth noting that I can create <code>db2</code> as long as I don't become <code>root</code> by typing <code>sudo i</code>. Unfortunately, if I don't become root I can't figure out how to access my <code>db2</code> remotely which is what I ultimately need to do. That is, I don't know how to access <code>db2</code> from my web app, <code>mysite.com</code>.</p>