1.查看MySQL日志是否启用,ON表示开启
MySQL>show variables like 'log_bin';
2.查看MySQL日志的名字
MySQL>show master status;
3.查看MySQL的data目录
Shell>ps -ef|grep mysql
4.切换到MySQL的安装目录下:
cd /usr/local/tools/mysql/bin
5.显示MySQL运行的日志
Shell>./mysqlbinlog /home/mysql/data/mysql-bin.000027
6.如果比较多,可以输出到文件
Shell>./mysqlbinlog /home/mysql/data/mysql-bin.000027 > temp.log
7.如果报错,加上一个--no-defaults参数
mysqlbinlog: unknown variable 'default-character-set=utf8'
Shell>./mysqlbinlog --no-defaults /home/mysql/data/mysql-bin.000027 > logs.temp