环境:linux deepin15.7 mysql 5.7
1.开启binlog
vim /etc/mysql/mysql.conf.d/mysqld.cnf
添加 log_bin = /var/log/mysql/mysql-bin.log
添加 server-id = 1
2.重启 mysql : service mysql restart
3.登录 mysql
4.常用命令
查询当前使用的日志文件: show master statusG;
查询日志文件: show binary logs;
查询指定文件内容: show binlog events in 'mysql-bin.000002' ;