Jump to content

Generating MySQL Backups via PHP


Doctor_Cox

Recommended Posts

Gentlemen,

 

The problem of how to generate a MySQL backup quickly via PHP quickly and efficiently has been stumping me for a while. I know the mysqldump trick, but for some reason under cPanel it generates needlessly bloated SQL I cannot even feed into phpMyAdmin. I have examined phpMyAdmin's code, but cannot figure out the exact part which enables it to export SQL so quickly. So I have been left with no choice to write code that generates insert statements one at a time. Very inefficient, and now my boss is getting maximum execution timeouts on one particularly large database.

 

Any insight that you might be able to offer would be much appreciated.

Link to comment
Share on other sites

not quite sure but try to cut your file try using outfile..

 

From the looks off this will save a file to the server, which is not really what we want. I want a download backup option.

 

I did a search on google and came up with this...

 

http://programsdb.com/script/742/15192/MySQL_database_backup.html

 

This performs backups the same way I do - but selecting all the lines then building insert queries with them. Works OK on small tables, but not when you are trying to download a series of tables containing no less than 249204 lines total, you need something a bit more efficient.

 

Thanks for the effort though, will keep looking.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.