Mysql automatic backup solution 1. Configure the database server 1. Write the mysql automatic backup script mysql backup mainly includes hot backup and cold backup. Hot Backup is used here, that is, using mysqldump to export SQL statements to back up # vi/etc/mysqlback. sh #! /Bin/bash www.2cto.com DB_NAME = "luwenju" // database DB_USER = "luwenju" // database username DB_PASS = "luwenju" // Database Password BIN_DIR = "/usr/ local/mysql/bin "// mysql environment variable BACK_DIR ="/opt "// Backup File Save data DATE =" 'date + % Y % m % d' "$ BIN_DIR /mysqldump-opt-u $ DB_USER-p $ DB_PASS $ DB_NAME> $ BACK_DIR/luwenju _ $ DATE. SQL # chmod + x/etc/mysqlback. sh test #/etc/mysqlback. sh # ls/opt/luwenju_20151126.sql2. Set the regular backup cycle. In this case, backup is performed every morning, the specific backup cycle depends on the specific application # crontab-e0 0 ***/etc/mysqlback. sh #/etc/init. d/crond restart3, install rsync # tar zxvf rsync-3.0.8.tar.gz # cd rsync-3.0.8 #. /configure & make install to create the configuration file and add the following content # vi/etc/rsync. confuid = nobody www.2cto.com gid = nobodyuse chroot = nomax connections = 10pid file =/var/run/rsyncd. pidlock file =/var/run/rsyncd. locklog file =/var/log/rsyncd. logport = 873 timeout = 300 [backup] read only = yes // read-only mode list = yesignore errorscomment = This is a file backpath =/opt // the directory to be synchronized auth users = test // verify the user secrets file =/etc/rsync. passwd // verify the password path hosts allow = 119.232.33.246 // The ibmfahsion of the client that can be connected