title: How to clone a test database from a production one in one single action?
body: <p>I am looking for a basic script/command that will create a copy of a live database (let name them <code>mydb</code> and <code>mydb_test</code>, both on the same server).</p>
  
  <p>Requirements</p>
  
  <ul>
  <li>it has to run even if the <code>mydb_test</code> already exists and have records</li>
  <li>it has to work even if <code>mydb</code> and <code>mydb_test</code> do have existing connections</li>
  <li>it have to clean the potentially existing database if necessary</li>
  </ul>
  
  <p>Hints:</p>
  
  <ul>
  <li><code>drop database</code> cannot be used if you have existing connections</li>
  </ul>