Knowledgebase

MySQL Database Import via Command Line

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.

  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: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 Bluehost username prefix with the _ (underscore) after it and the database name.



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read

Client Login

Email

Password

Remember Me