Im Jake Posted May 25, 2008 Share Posted May 25, 2008 Well, I was wondering if anyone had a simple script that made backups of my database which would be runefant_rf and put the backups with the date in a folder called backups. and it made 1 backup at the end of each day Quote Link to comment Share on other sites More sharing options...
phpSensei Posted May 25, 2008 Share Posted May 25, 2008 Heres a simple way to do it. mysqldump -ce --user=username --password=password dbname | gzip | uuencode dbbackup_e.gz | mail email@address.com Chaneg the dbbackup_e.giz to a time(); format, use mkdir and name it the time(); format, and move the renamed file to your backup folder. or like this $backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz'; $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile"; system($command); Quote Link to comment Share on other sites More sharing options...
Im Jake Posted May 25, 2008 Author Share Posted May 25, 2008 <? $dbhost = "localhost"; $dbuser = "runefant"; $dbpass = "pass here"; $dbname = "runefant_rf"; $backupfile = "backup"; $backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz'; $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile"; system($command); echo "Success!!!"; ?> thats my total code and its not making a backup Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted May 25, 2008 Share Posted May 25, 2008 Was just working with him.. Here's the file: <? $dbhost = "localhost"; $dbuser = "runefant"; $dbpass = ""; $dbname = "runefant_rf"; $backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz'; $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile"; system($command); echo "Success!!!"; ?> He's getting the echo Success!!! but the file is not being made. Quote Link to comment Share on other sites More sharing options...
Im Jake Posted May 25, 2008 Author Share Posted May 25, 2008 uhm, anyone? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.