Portal Home > Knowledgebase > MySQL Questions > How do I restore a database using SSH?


How do I restore a database using SSH?




First, you'll need to log into your account via a secure shell client like Putty or SecureCRT. Once there, you'll need to enter the following command: mysql $databasename -u $user -p$password < /path/to/$dump_file You'll need to substitute the correct information for the $variables in the line above. For instance, let's say that you have uploaded your database backup, calld backup.sql, to your public_html directory. Your account username is 'jack' and you are looking to restore a database called 'jack_phpbb', which is accessed by the user jack_forums and a password of blahblah. This is what the line would look like: mysql jack_phpbb -u $jack_forums -p$blahblah < /home/jack/public_html/backup.sql If you don't know the database username or password, you'll need to check the Mysql screen in Cpanel to get that information. Please note that there is purposely no space between the -p and the password when you enter this line. That is the way the line is supposed to be entered.


Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
What is Mysql? (Views: 384)

Powered by WHMCompleteSolution