Importing a SQL File That is Too Big for PHPMyAdmin

Oh Noes! My Database is Bigger than the Upload Limit!

Don’t worry! Here a neat little trick that helps you out. PHPMyAdmin can extract a couple of formats of compressed files, namely GZip, BZip2, and Zip. I’ve never had great luck with exporting from PHPMyAdmin as a compressed file, as PHPMyAdmin usually complains when I try to upload the compressed file that was generated by PHPMyAdmin.

So here’s a trick — you can compress the file yourself and upload that. The most awesome thing about that is that you’re no longer limited to exporting a SQL file from PHPMyAdmin; this works with any SQL file (and any text file, in all reality).

Getting Started

First, you’ll need any old SQL file and a Unix based OS, like Linux, BSD, or even Mac OSX. I use Ubuntu, and it has gzip, zip and bzip2 installed.

  1. Compress the SQL file: -$ gzip name-of-sql-file.sql
  2. By default, this will replace the file and append the appropriate compression extension.
    eg. the above will produce name-of-sql-file.sql.gz
  3. Upload the compressed version of the file to PHPMyAdmin


Here’s a brief comparison of GZip vs Bzip2 vs Zip:

Zip – Fastest method and most widely supported. Produces the least efficient compressed files.
GZip – Medium speed, and fairly good support. Resulting files are smaller than ZIP, but bigger than BZip2
BZip2 – Slowest algorithm, and decent support. Produces the most efficient compressed files.

For a full comparison of the above compression methods, follow this link:


Leave a Reply

Your email address will not be published. Required fields are marked *

Thanks for your thoughts!