Backing up MySQL data
Submitted by srlinuxx on Tue, 05/29/2007 - 02:35.
Backing up files and directories is relatively easy; databases, however, have some special quirks that you need to address. Our examples use MySQL, but the same principles apply to PostgreSQL and other relational databases.
If your MySQL server does not need to be available 24x7, a fast and easy offline raw backup method is:
1. Stop the MySQL server:
# /etc/init.d/mysqld stop
2. Copy MySQL's data files and directories. For example, if your MySQL data directory is /var/lib/mysql and you want to save it to /tmp/mysql-backup:
# cp -r /var/lib/mysql /tmp/mysql-backup
Instead of cp, you can use rsync, tar, gzip, or other commands.
3. Start the server again:
# /etc/init.d/mysqld start
Online backups are trickier.


Distributed data is constantly backed up by kernel 2.6.x ?
The purpose of unionfs or aufs, is to backup MySQL and other database, by synchronization(cron job on the fly) on another hdd(raid preferred) in other computers(as many as you want)?
However, Knoppix had problems of making unionfs work, because he did not try to back up MySQL specifically. Aufs is very new, and can be buggy as we will discover in kernel 2.6.22(memory merge)?
Kernel 2.4.34 has no unionfs or aufs, So cron jobs(each new posting to the database) on the fly, will have to be scripted.