View Full Version : automatically backup mysql database
March 5th, 2007, 11:11 PM
Is there a way to have an automatic backup of a mysql database? I want a .sql file that will recreate the whole database if needed, something like phpmyadmin creates with their export function.
I have my database on a shared hosting if that makes a difference.
March 5th, 2007, 11:56 PM
mysqldump will do it.
I made a shell script (backupscript.sh) to do daily backups and I call it with cron.
Replace things with what the word says (e.g. hostname is your database hostname)
I also gzip the file at the end but you can skip that step
echo "Backing up PHPBB database!"
/usr/bin/mysqldump --add-drop-table -u database_user -ppassword -hhostname database > /ABSOLUTEPATH/PHPBB_backup.sql
/bin/gzip -f /ABSOLUTEPATH/PHPBB_backup.sql
March 6th, 2007, 05:22 PM
I use the mysql admin application. In the backup section there is a schedule tab. It probably does the same thing the poster above is doing via the command line.
March 6th, 2007, 06:59 PM
thanks for the tips, the mysql admin seems pretty cool, thanks for the script also! much appreciated.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.