SQL Dump File Splitter

Scenario: You are a conscious user and you back up your site’s database every once in a while. And you sit smiling and content knowing that your precious data is safe. Just to discover after disaster strikes that you can’t restore the contents of the SQL dump file because of upload size limitations or because phpMyAdmin would run out of memory while decompressing the gzip / zip file.

In these cases there are two solutions at hand: if you have console access you can login and import the plain SQL file (which you previously uploaded via FTP) by typing a command like “mysql -uusername -ppassword < dumpfile.sql” or if you only have access to phpMyAdmin you can open up a text editor and split the SQL file into smaller parts that can be uploaded sequentially. The problem si that if you have a larger dump file this can be a reeeaaaly time consuming job.

Today I encountered a problem like this. And since I had no console access and I was in no mood to lose a few precious hours splitting up a 40 meg file by hand I googled for “sql splitter” and I found a program called SQLDumpSplitter 2. Unfortunately the author’s site was not working (and since I don’t know any German I couldn’t really figure out why) but I found an alternative download on a dutch web developer forum. And since that forum required to be a member to be able to download I thought I should offer yet another alternative download location without all those registration related mini headaches. Here on this site…

SQLDumpSplitter 2

So here it is ladies and gentlemen: download SQLDumpSplitter 2 (or zip compressed). All credits for writing this program go to Philip Lehmann-Böhm (http://www.philiplb.de).

Update (almost 8 years later): Since this is by far the most popular post on this blog, I believe it deserves an update.

If you’re having problems with SQLDumpSplitter 2 please have a look at the following resources (picked from the comments):

  • BigDump: Staggered MySQL Dump Importer – Imports large and very large MySQL dumps (like phpMyAdmin dumps) even through web servers with hard runtime limits and those in safe mode. The script imports only a small part of the huge dump and restarts itself. The next session starts where the last left off.
  • SQL splitter – A PHP script to split your SQL file into an array. Note that you’ll probably need PHP installed locally and configured pretty loosely (with high memory limit) to be able to process large SQL dumps with this script.

If you found this post useful be sure to check out the books below:

You may also like...