Friday, November 14, 2014

Using SSH to import your MySQL database

The file must be in .sql format. It can not be compressed in a .zip or .tar.gz file.
  1. Upload the SQL file to the server.
  2. If the database does not exist please create one with an user. Note the username and password.
  3. Log into the server through SSH
  4. Navigate to the directory where your .sql file is.
  5. Type this this command:
    mysql -p -u username database_name < file.sql Note: Bluehost 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 Bluehost username prefix with the _ (underscore) after it and the database name.

No comments:

Post a Comment