启用二进制日志
# cat /etc/my.cnf
[mysqld]
server_id=100
log_bin=/var/log/mysql/binlogs/server1
# mkdir -p /var/log/mysql/binlogs/
# chown -R mysql:mysql /var/log/mysql/
# systemctl restart mysqld.service
# 验证是否创建了二进制文件
# 第一个办法,直接进入目录中/var/log/mysql/binlogs/查看文件是否存在
# 第二种办法,命令行中查看
mysql> show variables like 'log_bin%';
mysql> show master logs; # 或者是 mysql> show binary logs;
mysql> show master status;