How to Import MySQL Database via Command Line

by Dinesh 2014-10-20 13:41:38

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:
  6. mysql -p -u username database_name < file.sql

Tagged in:

747
like
0
dislike
0
mail
flag

You must LOGIN to add comments