0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【BINLOG】クエリログ出力

Last updated at Posted at 2021-06-28
★binログ出力先を確認
# less /etc/my.cnf

[mysqld]
port = 3306
socket=/var/lib/mysql/mysql.sock
datadir=/var/lib/mysql
...
★binログ出力ファイルを確認
# cd /var/lib/mysql
# ll
-rw-rw---- 1 mysql mysql      67307  9月 21 21:01 2016 mysql-bin.000168
...
★日付抽出でのファイル出力方法
mysqlbinlog mysql-bin.000168
 --start-datetime="2020-10-16 10:10:00"
 --stop-datetime="2020-10-16 10:20:00"
 > /tmp/mysql-bin.000168.txt
★TBL名【hogehoge】を含んだ文の前3行、後ろ3行を抽出してファイルにはく方法
mysqlbinlog mysql-bin.000168| grep -i -B3 -A3 'hogehoge' >> ./sample.txt
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?