查看是否开启了binlog:
win+r => cmd => 连接mysql=>show variables like ‘log_%‘;
mysql> show variables like ‘log_%‘; +---------------------------------+-------------+ | Variable_name | Value | +---------------------------------+-------------+ | log_bin | ON | | log_bin_trust_function_creators | OFF | | log_error | .\mysql.err | | log_queries_not_using_indexes | OFF | | log_slave_updates | OFF | | log_slow_queries | ON | | log_warnings | 1 | +---------------------------------+-------------+
没有开启log_bin的值是OFF,开启之后是ON
开启binlog:
修改mysql配置文件 my.ini (在C:\ProgramData\MySQL\MySQL Server 5.6)
添加配置:log-bin=log-bin=D:\AppServ/MySQL/log/mysql-bin.log 测试发现必须给全路径(名字随意给)
重启mysql 会在log目录下新增两个文件mysql-bin.000001与mysql-bin.index
查看binlog:
win+r => cmd => 连接mysql=> show binary logs; =>可以查看自己binlog的名称
win+r => cmd => 连接mysql=> show binlog events; =>可以查看已生成的binlog
导出成文本文件:
D:\AppServ\MySQL\bin>mysqlbinlog >d:/test.txt
确保在bin目录下有mysqlbinlog.exe 没有的话搜索下载
mysql 使用mysqlbinlog查看日志的问题
mysqlbinlog mysql-bin.00005 --startdatetime=‘时间‘ --stopdatetime=‘时间‘ --database=DB_name | grep -i -A 6 ‘id=111‘
用grep..
Windows下mysql的binlog 位置在哪,版本是515
二进制文件在data目录下,
可以再mysql命令行执行, show variables like ‘%datadir%‘;查看data路径
原文地址:https://www.cnblogs.com/shamo89/p/8676480.html
时间: 2024-10-17 08:31:28