MySql__Mac下打开BinLog.
- 查看是否开启 log_bin.
show variables like 'log_bin';
- 在my.cnf配置文件中打开 bin_log 选项 【我在本机配置了双实例,所以log-bin-index配置了端口号】:
[mysqld]
server-id=1
log-bin=/usr/local/mysql_data/data3306/mysql-bin.log
log-bin-index=binlog3306.index
-
保存重启Mysql服务即可.
-
使用: show binary logs; 查看 binlog 日志文件名.
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin.000001 | 21973 |
+------------------+-----------+
- 使用: show binlog events; 查看 已生成的 binlog 事件
*************************** 65. row ***************************
Log_name: mysql-bin.000001
Pos: 21632
Event_type: Anonymous_Gtid
Server_id: 1
End_log_pos: 21697
Info: SET @@SESSION.GTID_NEXT= 'ANONYMOUS'
*************************** 66. row ***************************
Log_name: mysql-bin.000001
Pos: 21697
Event_type: Query
Server_id: 1
End_log_pos: 21778
Info: BEGIN
网友评论