1. 查看binlog日志是否开启
mysql默认是不开启binlog日志的,需要手动打开
mysql> show variables like 'log_%';
+----------------------------------------+-------------------------------------------------+
| Variable_name | Value |
+----------------------------------------+-------------------------------------------------+
| log_bin | OFF |
| log_bin_basename | |
| log_bin_index | |
| log_bin_trust_function_creators | OFF |
| log_bin_use_v1_row_events | OFF |
| log_builtin_as_identified_by_password | OFF |
| log_error | C:\Program Files\mysql\data\DESKTOP-7MV7HDB.err |
| log_error_verbosity | 3 |
| log_output | FILE |
| log_queries_not_using_indexes | OFF |
| log_slave_updates | OFF |
| log_slow_admin_statements | OFF |
| log_slow_slave_statements | OFF |
| log_statements_unsafe_for_binlog | ON |
| log_syslog | ON |
| log_syslog_tag | |
| log_throttle_queries_not_using_indexes | 0 |
| log_timestamps | UTC |
| log_warnings | 2 |
+----------------------------------------+-------------------------------------------------+
19 rows in set, 1 warning (0.02 sec)
可以看到log.bin日志为OFF并没有开启
2. 开启binlog日志
Linux找到my.cnf配置文件
windows找到my.ini配置文件
修改其中的内容
#第一种方式:
#开启binlog日志
log_bin=ON
#binlog日志的基本文件名
log_bin_basename=/var/lib/mysql/mysql-bin
#binlog文件的索引文件,管理所有binlog文件
l