How Import Databases Using Command Line SSH
Using SSH can be a superior way to manage the files and databases on your account. Using a simple command, you can import a MySQL database into an existing database on your account. SSH access is required for this process. Please see our article on getting SSH access if it has not yet been enabled on your account.
The file must be in .sql format. It can not be compressed in a .zip or .tar.gz file.
- Upload the SQL file to the server via the file manager or an FTP client.
- If the database does not exist, please create a database and a user. Ensure to give the user full privileges to the database. Please take note of the username and password.
- Log in to the server through SSH.
- Navigate to the directory where your .sql file is.
- Type in this command:
mysql -p -u user_name database_name < file.sql (replace 'user_name', 'database_name', and 'file.sql' with the actual name.)
- You will be prompted for your database user password, and then your database will be imported.