linux mysql日志查询

步骤:登陆mysql,查询日志库,获取日志信息。

---------------登陆、查询
$ mysql -u -p -h
> show binary logs;
+------------------+-----------+
| Log_name         | File_size |
+------------------+-----------+
| mysql-bin.002453 |    810301 |
| mysql-bin.002454 | 525033141 |
| mysql-bin.002455 | 525567869 |
| mysql-bin.002456 | 525685856 |
| mysql-bin.002457 | 525600872 |
| mysql-bin.002458 | 525343609 |
| mysql-bin.002459 | 525320701 |
| mysql-bin.002460 | 524613083 |
| mysql-bin.002461 | 131486180 |
| mysql-bin.002462 |     44219 |
+------------------+-----------+
10 rows in set (0.00 sec)

> exit

---------------------- 获取日志信息到本地
$ mysqlbinlog -u -p -h --read-from-remote-server mysql-bin.002462 > 1.log
$ mysqlbinlog -u -p -h  --base64-output=decode-rows --verbose --read-from-remote-server mysql-bin.002462 > 1.log

你可能感兴趣的:(linux mysql日志查询)