|
|
|
|
|
|
|
![]() |
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
![]() |
#1 |
Former pr0n slinger.
|
Backing up a MySQL database to a .txt file using a PHP script
I'm looking for some way to back up a huge MySQL database to a downloadable .txt file. I have found some PHP scripts like this one: http://www.zend.com/codex.php?id=634&single=1 but that doesn't seem to do anything.
Can anyone (cd34 or so ![]() Thanx! |
![]() |
![]() |
![]() |
#2 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
if it is huge, you're likely to run into timeouts on apache that aren't going to allow it to be downloaded completely.
What you can try is something like forking a process that does mysqldump -q -u username -ppassword databasename > /tmp/dump.sql and writing the pid of the forked process so that you can check to see if the process is still running. With most apache servers, in 2-3 minutes a php script (or any cgi script) will time out and kill the process -- resulting in an incomplete dump. Alternatively you can write your own dump that will go through the records one by one and output a . or space to the screen to keep apache from timing out.
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
![]() |
![]() |
![]() |
#3 |
Former pr0n slinger.
|
Thanx, I'll give that a try
![]() Oh and does there has to be a space between -p password? |
![]() |
![]() |
![]() |
#4 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
it needs to be -ppassword or -p'password' if there are characters that the shell might escape.
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
![]() |
![]() |
![]() |
#5 |
Internet! Is that thing still around?
|
I would generally recommend using mysqlhotcopy, mainly because its faster than mysqldump, although it uses locks.
But since you need a PHP script to do the work you probably don't have access to the server?! Check it out http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
|
|