How do I restore a MySQL database?


Important Notes:
This guide will need to be executed from the command line. If you do not know how to connect to your server using command line, you should first read "How do I connect to my Linux server by Command Line?

Getting Started:

  1. First, you'll need to create a new database on the server you're moving the data to. This can be done from Plesk. Log into Plesk, then click 'Domains'. Next click on 'Databases' and create a database with the same name as the database you're restoring:



  2. Once the database is created, you are going to want and go back to the command line and run the following command:



  3. [root@hostname]#mysql -u admin -p´cat /etc/psa/.psa.shadow´ [databasename] < [path of backup]

  4. The following example shows the above command, as if we were restoring a database named 'psa'. We saved the file in /root/psa.sql



  5. [root@hostname]#mysql -u admin -p´cat /etc/psa/.psa.shadow´ psa < /root/psa.sql

  6. Once this is done, you should have successfully restored your database.


This article has been provided by Codero Hosting, the leading provider of reliable dedicated, managed and cloud hosting services. Need more information on this topic or to learn more about Codero’s hosting services please visit www.codero.comchat with us online or give us a call at 866-2-CODERO.

Posted in
Last update:
2015-12-03 20:39
Average rating:0 (0 Votes)