MySQL误操作后的恢复
场景:
1、数据库每天都有全备份。
2、数据库开启bin-log
3、准确定位误操作语句
一、 创建全备份,建议带有 --master-data=2参数
mysqldump -uroot -ppassword123 -S /data/mysqldata/3306/mysql.sock -F -R --triggers --lock-tables --master-data=2 -B test > /data/mysqldata/backup/test.$(date "+%F_%H:%M:%S").full.sql
二、正常使用数据库
[[email protected] backup]# mysql -uroot -ppassword123 -S /data/mysqldata/3306/mysql.sock
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 43
Server version: 5.6.41-log Source distribution
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective