Backing up mysql dbs

Status
Not open for further replies.

pballz

New Member
Messages
24
Reaction score
0
Points
1
I'm looking at methods to automate backing up a db. So instead of playing around and most likely getting frustrated when stuff doesn't work I'm gonna ask for advice first.

I found this as one method of backing up a db.

Code:
<?php
            include 'config.php';
            include 'opendb.php';
            $backupFile = $dbname . [B]date("Y-m-d-H-i-s")[/B] . '.gz';
            $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile";
            [B]system($command);[/B]
            include 'closedb.php';
?>
But I've read sometimes the mysqldump command is turned off so I was wondering if anyone could tell if this would work. Also any other methods of backing up a db would be greatly appreciated.
 

calistoy

Free Support Volunteer
Community Support
Messages
5,602
Reaction score
87
Points
48
Go to phpMyAdmin and use the export function to export a backup copy of your database.
 

pballz

New Member
Messages
24
Reaction score
0
Points
1
I said I want to automate backing it up. Going to phpmyadmin isn't that automated. Do people read and try to understand before replying?
 

stpvoice

Community Support Rep
Community Support
Messages
5,987
Reaction score
212
Points
63
pball_inuyasha said:
I said I want to automate backing it up. Going to phpmyadmin isn't that automated. Do people read and try to understand before replying?
Please don't be rude, or you won't get any help.

There's also phpMyBackupPro, which is automated I believe. We have a wiki article about it here: http://x10hosting.com/wiki/PhpMyBackupPro
 
Last edited:

pballz

New Member
Messages
24
Reaction score
0
Points
1
Well just in case anyone ever finds this wondering the same thing. That code in the first post won't work since system() is blocked. But I did find a nice pure php script that saves a whole db to an sql file. I also made in addition a script to zip my whole site then ftp the sql backup and zipped backup. It also does email notifications.

If anyone is interested I'll share.
 
Status
Not open for further replies.
Top