title: Duplicate a mysql database from within mysql?
body: <p>This is probably a longshot but..
  is it possible to duplicate a whole database layout (tables, view, procedures, everything) with a query or multiple queries in a stored procedure?</p>
  
  <p>Basically looking for the same functionality as if I would use mysqldump like this</p>
  
  <pre><code># mysqldump -u root -ppassword --no-data --routines dbname &gt; file
    //create database copyofdbname
  # mysql -u root -ppassword copyofdbname &lt; file
  </code></pre>
  
  <p>Is it possible to do this in a mysql procedure without any external tools?</p>
  
  <p>I guess I could do the tables by using 'show tables' and then a iterate over the results to get the 'create table' statatements for each table and forward them into the new database.<br>
  This is just speculation though, no idea how I would copy the stored procedures from the database this way.</p>