Creating MySQL Backups With AutoMySQLBackup
Creating MySQL Backups With AutoMySQLBackupVersion 1.0 AutoMySQLBackup is a shell script that lets you take daily, weekly and monthly backups of your MySQL databases using mysqldump. It can back up multiple databases, compress the backups, back up remote databases, and email the logs. I do not issue any guarantee that this will work for you!
1 Preliminary NoteAutoMySQLBackup uses mysqldump to create SQL dumps of your databases. Please note that mysqldump will lock your databases while the backup is being created, and this can take from less than a second up to a few minutes, depending on the size of your database. If you're running a high-traffic web site with a large database, then AutoMySQLBackup is not for you! This script will not help in the event of a hard drive crash. You should copy your backups offline regularly for best protection.
2 Using AutoMySQLBackupYou can download AutoMySQLBackup as follows: cd /usr/local/bin Then open automysqlbackup.sh.2.5 and take a look at the configuration options. They are all well explained. You should at least configure the following settings: vi automysqlbackup.sh.2.5
DBNAMES can contain one or multiple databases, separated by spaces. If BACKUPDIR does not exist, automysqlbackup.sh.2.5 will create it automatically. Make sure you fill in the right password and database host. If you want to back up local databases, use localhost; if you want to back up remote databases, use the remote hostname (please note that the remote database server must be configured to allow remote connections!). Now we must make the script executable: chmod 755 automysqlbackup.sh.2.5 Now you can run automysqlbackup.sh.2.5 like this if you are in the /usr/local/bin directory: ./automysqlbackup.sh.2.5 ... or like this from any other directory: automysqlbackup.sh.2.5 This is a sample output: server1:~# automysqlbackup.sh.2.5 Take a look at the /backups directory... ls -l /backups ... and you should find three subdirectories, daily, weekly, and monthly: server1:~# ls -l /backups/ These directories will contain subdirectories named after the databases you chose to backup. For example, if you chose the database db_ispconfig, there will be a directory /backups/daily/db_ispconfig containing the database dump: cd /backups/daily/db_ispconfig server1:/backups/daily/db_ispconfig# ls -l The .gz extension means it's compressed. To restore a database, you'd first have to uncompress the dump: gunzip db_ispconfig_2008-10-17_16h00m.Friday.sql.gz ... (this will give you the uncompressed dump named db_ispconfig_2008-10-17_16h00m.Friday.sql) and then restore it as described on http://www.howtoforge.com/faq/6_4_en.html. Of course, you don't want to run automysqlbackup.sh.2.5 manually all the time. Therefore, we can create a daily cron job for it as follows: cd /etc/cron.daily/
3 Links
|
Join the discussion.
www.seamlessenterprise.com
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com
Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com







Recent comments
15 hours 42 min ago
17 hours 10 min ago
20 hours 45 min ago
23 hours 38 min ago
1 day 2 hours ago
1 day 3 hours ago
1 day 3 hours ago
1 day 4 hours ago
1 day 5 hours ago
1 day 6 hours ago