Importing a MySQL via CLI (Command Line Interface)

The file must be in .sql format. It can not be compressed in a .zip or .tar.gz file.

  1. Start by uploading the .sql file onto the CCIHosting server
  2. If you haven't already done so, create the MySQL database via the cpanel. Click Here for video tutorial
  3. Using SSH, navigate to the directory where your .sql file is.
  4. Next run this command:

 mysql -p -u username database_name < file.sql 

To import a single table into an existing database you would use the following command:

mysql -u username -p -D database_name < tableName.sql
  • 564 Users Found This Useful
Was this answer helpful?

Related Articles

Exporting a MySQL via CLI (Command Line Interface)

Using SSH, execute the following command: mysqldump -p -u username database_name > dbname.sql...

MySQL database replication in CentOS

This tutorial describes how to set up database replication in MySQL. MySQL replication allows you...