1、开启log_bin日志

–1.1 查看状态

mysql>show variables like '%log_bin%';

log_bin | OFF

–1.2编辑配置文件

vi /etc/my.cnf

–1.3添加

server-id=1
log-bin=/var/lib/mysql/mysql-bin

–1.4重启mysql

service mysqld restart

–1.5查看状态

mysql>show variables like '%log_bin%';
log_bin ON

2、开启general_log日志

–2.1查看状态

mysql> show global variables like '%general%';

general_log | OFF

–2.2执行命令

mysql> set global general_log=on;

–2.3查看状态

mysql> show global variables like '%general%';

general_log | ON