How do I import my MySQL database via command line or shell?

For databases larger than 100MB, we suggest uploading via the command line using Terminal in cPanel.

The syntax would be:

mysql -p -u user_name data_base < new_databse.sql

user_name is your cPanel username

data_base is the database to import to

new_databse.sql is the .sql file you are trying to import


You will then be prompted for a password. That will be your cPanel password.

Was this answer helpful?

Related Articles

How do I create a MySQL database?

You can easily create a MySQL database in cPanel under "MySQL Databases".

My script or app is asking for hostname, what do I use?

If your script or application asks you to enter your MySQL server hostname, you can simply...

What do I use for server address?

For your connection settings for a MySQL database server address, simply use: LOCALHOST