# 查看 binlog 已启用
SHOW VARIABLES LIKE 'log_bin';
# 查找 binlog 文件
SHOW BINARY LOGS;
# 查找当前使用的binlog文件
show master status;
# 查找binglog文件所在目录
show variables like 'log_bin%'
# 查看日志存储格式
show variables like 'binlog_format%'
# 查看日志事件类型
SHOW BINLOG EVENTS IN 'binlog*';
# 导出sql
sudo mysqlbinlog --start-datetime="2025-02-23 23:35:00" --stop-datetime="2025-02-23 23:58:00" --skip-gtids=true -vv /**/binlog > restore.sql
# 导出的sql不能执行执行,找到需要恢复的delete语句,并将sql改为insert。然后恢复sql
mysql -u root -p < restore.sql