How do I import a database using command line? (SSH)
**SSH access is required for this process. Click Here for information about getting SSH access
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.
- If the database does not exist please create one with an user. Note the username and password.
- Log into the server through SSH
- Navigate to the directory where your .sql file is.
- Type this this command:
# mysql -p -u username database_name < file.sql
Note:Free1host recomends using the database user with the database users password not the cPanel main user and password. The -p will cause mysql to prompt for your account's password. Do not put passwords in command line in plain text, but let the system prompt for a password. This is for your own security.
Make sure your database name has your MostHost username prefix with the _ (underscore) after it and the database name.