ASPit - Totally ASP JSit - Totally JavaScript
Search PHPit

Use this textbox to search for articles on PHPit. Seperate keywords with a space.


DB-Upload, a database utility

(Page 1 out of 1)

What is it?
DB-Upload is a new database utility for MySQL. This utility allows you to upload large .SQL files, that phpMyAdmin cannot handle. This will allow you to restore database backups that are several hundred MB big.

Why not use command line/shell/SSH?
You should use the MySQL command line client and shell access to restore a large database. It's the only way that's 100% reliable. But face it, not all web hosts allow you shell access. In fact, most web hosts won't give you access. If you need to restore a big database what do you do? phpMyAdmin can't handle sql files that are bigger than 5 MB, so you're pretty much screwed. But with DB-Upload, you can upload much bigger databases. During testing, I have uploaded databases of 90 MB and 500 MB. It can probably do larger databases as well.

How does it work?
DB-Upload executes the sql file in parts (of 100 KB), instead of doing it all at once. This way, it doesn't have the timeout problems that most PHP scripts have. In addition, it doesn't have any memory issues, because each part is only 100 KB.

The downside of this is time. It will take a while to upload a decent size database. It took me about 15 minutes to upload a 90 MB database on my localhost. It probably takes longer on a live server.


  1. Download the utility: db-upload.php
  2. Upload your .sql file to your server and remember where you uploaded it to (the file path is what you need to know)
  3. Upload the DB-Upload utility to your server
  4. Goto
  5. You'll be presented with a screen where you can enter all the settings. Make sure they're correct!
  6. Click on 'Upload Database', and off you go. Just keep running it. DON'T close the window.

That's all there is to it.

7 Responses to “DB-Upload, a database utility”

  1. jamie Says:

    the php file, only shows the code, please help

  2. jamie Says:

    hey, have worked out how to get the php file going
    but i keep getting “Invalid File Specified. Go back and enter a different file path!”
    i hvae uploaded it to /public_html/SQL/sql.sql
    but it keeps saying there is an error?

  3. jamie Says:

    sorry about all this!
    have got the program to work now
    but i get this error message at teh start

    Warning: fread(): Length parameter must be greater than 0. in /home/smcc/public_html/SQL/db-upload.php on line 366

    and then it only uploads 1.4mg before crashin!

  4. tqm Says:

    somehow in certain bytes the codes screw up… it keeps looping to previous byte… tried change the begin value. this works but, its that possible some of the data not uploaded. how to safely change the begin value?

  5. Dennis Pallett Says:

    Unless you know the exact byte at which it stopped, I don’t recommend changing the begin value, as you might upload the same thing twice. All you can do now is start over (unfortunately).

  6. axar Says:

    i’m geting the same error as jamie here is the link to the erro its same as what jamie has said

  7. webby from hull Says:

    hey i am getting the same error is anyone managing to fix this??

Leave a Reply

About the author
Dennis Pallett is the main contributor to PHPit. He owns several websites, including ASPit and Chill2Music. He is currently still studying.
Article Index
  1. DB-Upload
Bookmark Article
Download Article
Download this article as a PDF file