A simple mysql full backup script to back up the data of the last 15 days.
Backup
#每天备份mysql数据库(保存最近15天的数据脚本) DATE=$(date +%Y%m%d) /home/cuixiaohuan/lamp/mysql5/bin/mysqldump -uuser -ppassword need_db > /home/cuixiaohuan/bak_sql/mysql_dbxx_$DATE.sql; find /home/cuixiaohuan/bak_sql/ -mtime +15 -name '*.sql' -exec rm -rf {} \;
Restore
mysql data import
drop databases need_db; create databases need_db;
Import data: encoding must be set Recover
./mysql -uroot -p --default-character-set=utf8 need_db < xx.sql
Recommend learning mysql video tutorial: https://www.php.cn/course/list/51.html
The above is the detailed content of Mysql simple full backup and quick recovery method. For more information, please follow other related articles on the PHP Chinese website!