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

    is a control panel made by the Parallels company. Aplus.net supplies Plesk as a platform independent Gui that make the administration of Domains, E-mail, Statistics simpler than administrating the Operating system itself.'); return false">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.



Related Articles

No related articles were found.

Attachments

No attachments were found.

Visitor Comments

No visitor comments posted. Post a comment

Post Comment for "How do I restore a MySQL database?"

To post a comment for this article, simply complete the form below. Fields marked with an asterisk are required.

   Name:
   Email:
* Comment:
* Enter the code below:

 

Article Details

Last Updated
25th of June, 2009

See also:
Troubleshooting your server.

Would you like to...

Print this page  Print this page

Email this page  Email this page

Post a comment  Post a comment

 Subscribe me

Subscribe me  Add to favorites

Remove Highlighting Remove Highlighting

Edit this Article

Quick Edit

Export to PDF


User Opinions

No users have voted.

How would you rate this answer?




Thank you for rating this answer.

Continue