MySQL 日志

MySQL 日志

Shawn Yan Lv.6

MySQL Logs

  • binary log
  • error log
  • slow log
  • audit log

Audit Log

format

1
2
[timestamp],[serverhost],[username],[host],[connectionid],
[queryid],[operation],[database],[object],[retcode]

Check Logs

1
2
3
4
5
6
7
8
9
10
# bin log
mysqlbinlog MYSID.000041 -d test -s -r test_binlog.log
# mysqlbinlog MYSID.000041 -vv --base64-output=DECODE-ROWS -d test --start-position=1120 --stop-position=1919
mysqlbinlog -vv --base64-output=DECODE-ROWS MYSID.000041 -d test
## 日志事件偏移量
mysqlbinlog MYSID.000001 | egrep '^# at '
strings -n 2 -t d MYSID.000001

# slow log
mysqldumpslow slow.log

Reference

  • Title: MySQL 日志
  • Author: Shawn Yan
  • Created at: 2018-04-23 16:16:01
  • Updated at: 2018-04-23 16:16:01
  • Link: https://shawnyan.cn/2018/mysql/mysql-log/
  • License: This work is licensed under CC BY-NC-SA 4.0.
 Comments