Download Database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Download Database

Post by SidewinderX »

I'm working on the backend of a small CMS I created, and I want to give the user the ability to click a "Download" button and allow the database's SQL file to be downloaded. I was wondering how I go about creating the sql file from the database.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

Do you have access to the command line? If so, mysqldump is easy to use. http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html

If you have a control panel like phpMysqlAdmin, you should be able to create a text file with the Dump data in it, then that's what you have your users download.

Is it critical that the dump contain all the latest data? If so, you may need to find a way to dump it dynamically, in real time.
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Post by SidewinderX »

Well I do, but since other people are going to be using this aside from me, I would like to assume the worst case scenario. With no access to the command line or phpmyadmin.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Have a look at Bigdump and similar ilk.
Post Reply