How do I restore a MySQL database?
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?
- 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:
- Once the database is created, you are going to want and go back to the command line and run the following command:
|[root@hostname]#mysql -u admin -p´cat /etc/psa/.psa.shadow´ [databasename] < [path of backup]
- The following example shows the above command, as if we were restoring a database named 'psa'. We saved the file in /root/psa.sql
|[root@hostname]#mysql -u admin -p´cat /etc/psa/.psa.shadow´ psa < /root/psa.sql
- 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.com, chat with us online or give us a call at 866-2-CODERO.