How do I import a database via SSH?
Posted by - NA -, Last modified by Randi O on 26 October 2016 01:21 PM

Important a database via SSH isn't complicated. However, it has to be done correctly; otherwise it can become complicated very quickly. Below is a brief outline of what should be done before you do the import:

Getting the database ready:

Login to your cPanel hosting account.
Create a database
Create a username / password for your database
Assign the username to your database (set all privileges)
Your ready to start the import
Importing the database:

Login to SSH (Secure Shell)
You will need to use this line: mysql -u user -p dbname < {path}/backup.sql
User = the username you created in step 3
dbname = the database name you created in step 2
backup.sql = this is the name of your .sql backup file

Above you will need to update the line in step 2 and then paste the newly created line into the SSH window. It will ask you for a password which is the same password as you created in step 3.

Powered by TurnKey Internet]]>