When trying to import a MySQL dump or SLQ file into a database through web based tools you may have difficulty due to the size of the SQL file being imported. It is recommended to use SSH to import your MySQL SQL file. Simply login to your account using SSH and enter the directory where you have uploaded the SQL file to be imported.
You will need to either create a new database and database user via your cPanel or overwrite an existing database. Simply use the following command to import your SQL file into the database of your choice.
mysql -u DBUSER -pDBPASS DBNAME < dump.sql
Replace text in uppercase with the appropriate information:
DBUSER
- Database user with privileges to the databaseDBPASS
- Password for the database userDBNAME
- Database name
Please note, if your password contains special characters (* ? [ < > & ; ! | $
), you will either need to escape them with a backslash, put the password between single quotes, or leave the password out (you'll be prompted to enter password). Here are some examples:
Escaped Password
mysql -u DBUSER -pM\*Y\?P\[A\<S\>S\&W\;O\!R\|D\$ DBNAME < dump.sql
Password In Quotes
mysql -u DBUSER -p'M*Y?P[A<S>S&W;O!R|D$' DBNAME < dump.sql
No Password
mysql -u DBUSER -p DBNAME < dump.sql