Importing Databases via SSH

Using Command Line (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 via the file manager or an FTP client.
  2. If the database does not exist, please create a database, a user, and give the user full privileges to the database. Note the username and password.
  3. Log into the server through SSH
  4. Navigate to the directory where your .sql file is.
  5. Type in this command:
    mysql -p -u user_name database_name < file.sql (replace 'user_name', 'database_name', and 'file.sql' with the actual name.)
  6. You will be prompted for your database user password, and then your database will be imported.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Run OPTIMIZE TABLE to defragment tables for better performance

For this suggestion:Run OPTIMIZE TABLE to defragment tables for better performanceRun this...

How to clear Error Log of a cPanel Account.

User the below code to clear Error Log:Replace User with Username:Code:for i in `find...

What is php.ini ?

The php.ini file and changing PHP Settings The php.ini file is a special file for PHP and...

How to fix ini_set() has been disabled for security reasons

1. Create php.ini file inside your public_html folder, OR the folder in which you have...

How to fix Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone:

1: Create .htaccess file inside your public_html folder, OR the folder in which you have...