How to Backup & Restore MySQL Database Using SSH

 

In this tutorial we are going to discuss how to Backup and restore MySQL databases using SSH on Linux VPS server account..

If you are planning to backup or restore MySQL database using command line, you can follow the given steps.

 

Steps to Backup MySQL databases

Connect through SSH and run MySQL

  • Connect to the server through SSH

  • This will tell you about the directory you are working in.

  • You can restore the SQL file by running the following command:

mysqldump -u DATABASE_USERNAME -p DATABASE_NAME > FILENAME.SQL

 

  • Once the MySQL dump has been finished the SQL file will be stored in the working directory of your server on Linux VPS server.

  • When this is finished without mistakes the order line will come back to the beneath:

This email address is being protected from spambots. You need JavaScript enabled to view it. [~]#

  • If you need a local copy of your MySQL database you can download it using FTP.

 

Now you have successfully backup your MySQL databases using SSH access. Need more help! Contact our support team today via live chat or phone.

Restore MySQL Database
Mainly there are 2 steps to restore MySQL backup via command line:

  • Upload MySQL file through FTP to server

  • Connect via SSH & run MyMySQL

 

Upload SQL file through FTP to server

  • Connect to the server through FTP

  • Locate the SQL file on your local system

  • Upload the file to the home directory of your linux VPS server hosting account

 



Connect Through SSH & run MySQL

  • Connect to your web server through SSH

  • Enter PWD in the SSH screen, this will again tell you what the directory you are working in

  • To restore the MySQL file the was uploaded you can run the command given below:

  • mysql -uDATABASE_USERNAME -p DATABASE_NAME < FILENAME.SQL

  • When this is finished without issues the command  will come back to the underneath:

This email address is being protected from spambots. You need JavaScript enabled to view it. [~]#

 

All done, now you have restored your MySQL databases using SSH as well as backed up your MySQL databases on your Linux VPS server hosting account. In case you are facing any difficulty, feel free to contact our support team via email, phone, live chat or ticket system. We are available round the clock to help you.