Web systems, the most important thing is the security and integrity of the database.
It 's important to do a regular backup, so don't be lazy on this issue. If your important data is lost, it will make you cry without tears.
export table structure and dataMysqldump-uroot-pmypassword--databases fansunion--result-file=/var/www/backup/fansunion-table-and-data.sql
Export only table structureMysqldump-uroot-pmypassword--databases fansunion--no-data--result-file=/var/www/backup/fansunion-table.sql
Export Data onlyMysqldump-t-uroot-pmypassword--databases fansunion--result-file=/var/www/backup/fansunion-table-and-data.sql
Import DataSource/var/www/backup/fansunion-table.sql
Scheduled BackupsUse crontab scheduled backup mysqlcrontab-e daily 17 o'clock, execute backup script 0 * * * */VAR/WWW/AUTOBACKUP-MYSQL.SH (online There is said that can be placed users, but tried the next, no, ' 0 * * * * Root/ Var/www/autobackup-mysql.sh ')
autobackup-mysql.shnow= ' Date ' +%y%m%d%h%m%s "' file="/var/www/backup/fansunion-table-data-"$now". sql "/usr/local/mysql/bin/mysqldump- Uroot-pmypassword--databases fansunion-t > $file
Remember that the mysqldump must use the full path. Reference: http://bbs.chinaunix.net/thread-512166-1-1.html
0 * * */root/backup/autobackup-mysql.sh
Starting from the original:Http://fansunion.cn/article/detail/58.html
MySQL database timed automatic backup script