WebGee DocsDocs
Databases

Import a large database

Import a database too large for phpMyAdmin using SSH, and what to do when SSH is not available to you.

Import a .sql file that phpMyAdmin cannot handle. Applies to shared, reseller and Premium hosting.

phpMyAdmin imports through your browser, so it is limited by upload size and execution time. Anything much over 50 MB tends to time out part-way, leaving a half-imported database — which is worse than a clean failure.

Before you begin

You need:

Import over SSH

Connect, then run:

mysql -p -u cpaneluser_dbuser cpaneluser_dbname < ~/database.sql

Enter the database user's password when prompted. Both names carry your cPanel username as a prefix.

Nothing is printed while it runs. A large import takes minutes; the prompt returning is the signal it finished.

Put the password on the command line only if you must — -p'password' with no space. It ends up in your shell history, so prefer being prompted.

A compressed dump

No need to extract it first:

gunzip < ~/database.sql.gz | mysql -p -u cpaneluser_dbuser cpaneluser_dbname

Check it worked

mysql -p -u cpaneluser_dbuser cpaneluser_dbname -e "SHOW TABLES;"

Compare the table count against the source database. A short list means the import stopped early.

If SSH is not available

Split the file instead. Most database export tools can export table by table, so you can import each part through phpMyAdmin separately.

Alternatively compress the dump — phpMyAdmin accepts .sql.gz, and the smaller upload often gets under the limit that was stopping you.

If the import fails part-way

  • MySQL server has gone away — a single statement exceeded the packet limit, usually a very large row. Open a ticket.
  • Access denied — the user has no privileges on that database. Check Add User To Database in cPanel.
  • Table already exists — the database was not empty. Drop the tables and import again; a partial import cannot be resumed.

On this page