How to Restore MySQL Database using Command in SSH?

Step 1
Log in to the VPS with the root user.

# ssh root@VPS_IP_address

Step 2
Enter the following command in the terminal – 

# mysql -u [username] –p [database_name] < [dump_file.sql]

> database_name is the name of the empty database into which you want to load data from the backup file.

Step 3
Enter the username and password if prompted for a password.

Was this answer helpful?

« Back