title: How to download and upload SQL database as .sql file using php?
body: <p>I need a php code which downloads and uploads one database file.</p>
  
  <p>i.e. I have these databases <code>accounts</code>, <code>information</code> and <code>data</code>.</p>
  
  <p><strong>Backup:</strong></p>
  
  <p>I need a help to download database <code>data</code> as <code>.sql</code> file. And for your extra information, that database contains 5 tables. I want to download all into a single file.</p>
  
  <p><strong>Restore:</strong></p>
  
  <p>I should also be able to upload the same <code>.sql</code> file for restoring purposes. It should replace the available <code>data</code> database.</p>
  
  <p>EDIT</p>
  
  <p>I know its possible via phpmyadmin and cannot use it as I am going to let my clients download the sql file. And I cannot give them my phpmyadmin password.</p>
  
  <p>And more-over its not essential that I need to do it via <code>.sql</code> file, it may be of any format which is good &amp; easy for backing up and restoring the database.</p>
  
  <p>Thank you.</p>