Short answer: Compress database dumps into .sql.gz before uploading via phpMyAdmin, or import directly through terminal CLI using mysql -u user -p db_name < dump.sql to bypass browser limits.
Overcome phpMyAdmin upload size restrictions and MySQL Error 2006 (Server Has Gone Away) when importing large database backups.
Before you start: Back up your site files and database and download the backup to your own computer. How to take a full backup
Quick reference
| Default phpMyAdmin Limit | Typically 50MB to 128MB |
|---|---|
| Best Compression | .sql.gz or .zip (Reduces SQL filesize by ~80%) |
| SSH Import Command | mysql -u dbuser -p dbname < backup.sql |
Steps
- Compress the SQL Dump: Before uploading via phpMyAdmin, compress your
.sqlfile into a.zipor.gzarchive. phpMyAdmin automatically decompresses it on the server, allowing you to bypass upload limits. - Increase PHP Upload Limits in cPanel:
- Go to cPanel > Select PHP Version > Options.
- Increase
upload_max_filesizeto128Mor256M. - Set
post_max_sizeequal to or higher thanupload_max_filesize.
- Import via cPanel Terminal / SSH (Recommended for Dumps > 100MB):
- Upload your
database.sqlfile to your home directory via cPanel File Manager. - Open Terminal in cPanel (under Advanced) and run:
mysql -u CPANELUSER_DBUSER -p CPANELUSER_DBNAME < database.sql - Enter the database user's password when prompted. The import will run in the background without HTTP timeout constraints.
- Upload your
Troubleshooting and tips
- Packet Too Large Error: If an individual row or binary blob exceeds
max_allowed_packet, the server drops the connection with "MySQL server has gone away". Export your SQL dump with--net_buffer_length=16384or split the file. - Foreign Key Constraint Failures: Add
SET FOREIGN_KEY_CHECKS=0;at the very top of your SQL dump file, andSET FOREIGN_KEY_CHECKS=1;at the bottom to avoid order-of-insertion errors.
Need more help? If you run into an error while following these steps, open a ticket with technical support and our team will look into it. Open a ticket