Importing a database that’s too large for phpMyAdmin

Options for importing big SQL files: compression, splitting the file, importing table by table, and restoring through a DirectAdmin backup.

How-to guideIntermediate2 min readUpdated

phpMyAdmin runs through PHP, so its imports are limited by upload size and execution time. For big databases, work around those limits.

1. Compress the file

A .sql file often compresses to a tenth of its size. Gzip it (.sql.gz) or zip it (.sql.zip) and import that. phpMyAdmin decompresses it on the server.

2. Allow interruption

On the Import screen, keep Allow the interruption of an import in case the script detects it is close to the PHP timeout ticked. If it stops, run the import again with the same file; phpMyAdmin offers to resume.

3. Split the file

Use a free SQL file splitter to break the dump into pieces that each fit the limit, then import them in order. Make sure the tool splits between complete statements.

4. Export and import table by table

On the old host, export the largest tables separately from the rest. Import the small tables in one file and each large table on its own.

5. Reduce what you’re moving

Large WordPress databases are often mostly logs, sessions, spam or expired transients. Clean up before exporting. Cleaning up and optimising the WordPress database

6. Use a DirectAdmin backup restore

If you’re moving from another DirectAdmin host, a full account backup restored through System Info & Files then Create/Restore Backups imports databases without phpMyAdmin’s limits. How to restore a full account backup

Check the result

Compare table counts and row counts for key tables with the original.

Looking for somewhere to run PHP and MySQL? Traxio’s free PHP MySQL hosting includes phpMyAdmin and is free for your first 30 days.

Popular

Tip: press / to search from any pageSee all results