Mysql simple full backup script and Fast recovery method
Today Xiaobian shared with you is mysql simple full backup script and fast recovery method, many people do not know much, today Xiaobian in order to let everyone know more about mysql, so give you a summary of the following content, look down together. I'm sure you'll find something.
A simple mysql full backup script that backs up the last 15 days of data.
backup
#Backup mysql database daily (save last 15 days data script)DATE=$(date +%Y%m%d)/home/cuxiaohuan/lamp/mysql5/bin/mysqldump -uuser -ppassword need_db > /home/cuxiaohuan/bak_sql/mysql_dbxx_$DATE.sql;find /home/cuxiaohuan/bak_sql/ -mtime +15 -name '*.sql' -exec rm -rf {} \;
recovery
mysql data import
drop databases need_db;create databases need_db;
Import data: encoding must be set for recovery
./ mysql -uroot -p --default-character-set=utf8 need_db < xx.sql
The above is a brief introduction to mysql simple full backup scripts and quick recovery methods, of course, the detailed use of the above differences have to be used by everyone to understand. If you want to know more, welcome to pay attention to the industry information channel!