phpMyAdmin is fine for a few-megabyte database, but past a certain size it stops being the right tool: the upload runs into upload_max_filesize, the PHP request hits max_execution_time, and the browser gives up on a connection that has gone quiet for minutes. Bumping those limits buys you a slightly bigger ceiling and a more frustrating failure higher up. For anything from a few hundred megabytes to many gigabytes, the command line is the answer — the mysql client reads the dump straight off disk with no upload step, no web server in the path, and no request timeout. The workflow below is the one that completes a 10 GB restore as reliably as a 100 MB one.
What’s happening
A phpMyAdmin import is a web request: the browser uploads the file, PHP receives it under upload_max_filesize/post_max_size, and the import runs inside one PHP process bounded by max_execution_time and memory_limit. Every one of those is a wall a large dump can hit, and the failure modes are ugly — a half-imported database, a “Maximum execution time exceeded”, or a silent browser timeout that leaves you unsure how far it got.
The CLI path removes all of that. You move the dump file onto the server once (SCP, SFTP, or a download straight to the box), then feed it to the mysql client, which streams it into the database as fast as the disk and InnoDB can apply it, for as long as it takes. There is no upload limit because there is no upload, and no request timeout because there is no request. The only real constraints become max_allowed_packet (which must be big enough for the largest single statement) and the time the disk takes to write — both of which you control directly. SSH access on a cPanel host comes either from WHM-enabled shell access or from a jailed shell; either is enough for mysql against the local socket.
How to verify
Confirm you have shell access and the dump is intact before starting:
# Confirm SSH works and you can reach MySQL locally
ssh cpuser@server.example.com
mysql -e "SELECT VERSION();"
# Is the dump complete? A good mysqldump ends with this line
ls -lh ~/dump.sql
tail -5 ~/dump.sql | grep -i 'Dump completed'
Check the destination database exists and note the prefixed name cPanel requires:
# The database must already exist (create it in cPanel » MySQL Databases first)
mysql -e "SHOW DATABASES LIKE 'cpuser_%';"
# Confirm the packet ceiling is big enough for the largest statement
mysql -e "SHOW VARIABLES LIKE 'max_allowed_packet';"
# Free space and a rough idea of how long the write will take
df -h /var/lib/mysql
du -h ~/dump.sql
If the dump is compressed, you do not need to decompress it to disk first:
# Peek inside a gzipped dump without unpacking the whole thing
zcat ~/dump.sql.gz | head -20
The fix
- Get the dump onto the server without the browser — move the file with SCP from your machine (
scp dump.sql cpuser@server:~/) or SFTP, or download it directly to the box withwget/curlif it lives at a URL. This one transfer replaces the entire fragile phpMyAdmin upload step. For very large files,rsync --progresslets a interrupted transfer resume. - Create the target database in cPanel first — the CLI import loads into a database; it does not create the prefixed cPanel database for you. In cPanel » MySQL Databases, create
cpuser_dbnameand attach a user withALL PRIVILEGES, so cPanel’s records stay consistent. Importing into a database you made only in raw SQL can leave cPanel unaware of it. - Run the import with the mysql client — the core command:
mysql -u cpuser_dbuser -p cpuser_dbname < ~/dump.sql. It reads the file from disk and applies it with no upload and no web timeout. For a compressed dump, stream it without unpacking:zcat ~/dump.sql.gz | mysql -u cpuser_dbuser -p cpuser_dbname— this avoids writing a giant uncompressed file to disk. - Raise
max_allowed_packetif a big statement fails — if the import dies with “MySQL server has gone away” partway through, a single statement exceeded the packet limit. Pass it on the client and confirm the server matches:mysql --max_allowed_packet=512M -u cpuser_dbuser -p cpuser_dbname < ~/dump.sql. This is the most common large-import failure and the easiest to fix. - Let it run unattended with screen or nohup — a multi-hour import should survive your SSH session dropping. Start it inside
screen(ortmux): runscreen, launch the import, detach with Ctrl-A then D, and reattach later withscreen -r. Alternativelynohup mysql ... < dump.sql > import.log 2>&1 &runs it in the background and logs the outcome. A dropped laptop connection should never kill a restore. - Disable key checks for a faster, order-safe load — for a dump with foreign keys, wrapping the load avoids both 1452 errors and per-row index updates: prepend
SET FOREIGN_KEY_CHECKS=0; SET UNIQUE_CHECKS=0;and append the matching=1lines, or runmysql ... -e "SET FOREIGN_KEY_CHECKS=0; SOURCE ~/dump.sql;". A standardmysqldumpalready brackets itself; this matters mainly for hand-made or partial dumps. - Verify the import landed completely — after it finishes, count tables and spot-check row counts against the source:
mysql -e "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='cpuser_dbname';"and aSELECT COUNT(*)on the biggest tables. An import that ran to the end of the file without an error, and whose table and row counts match the source, is genuinely complete — the absence of an on-screen error alone is not proof.
The whole point is to stop fighting web limits that were never meant to handle gigabytes. Move the file once, feed it to the mysql client, run it under screen, and verify the counts — the same procedure scales from a hundred megabytes to tens of gigabytes without changing. Stack Harbor runs large database migrations and restores under managed cPanel operations — start a conversation when an import is too big for the browser.