First, enter docker's MySQL container.
Log in to the MySQL server and check the location of general_log
as shown below.
mysql> show variables like 'general_log%';
+------------------+---------------------------------+
| Variable_name | Value |
+------------------+---------------------------------+
| general_log | OFF |
| general_log_file | /var/lib/mysql/55ca40b8744.log |
+------------------+---------------------------------+
2 rows in set (0.00 sec)
Since it is OFF
, set it to ON
.
If you don't do this, the file doesn't seem to appear.
mysql> set global general_log = on;
Query OK, 0 rows affected (0.01 sec)
Go out of MySQL and go to var/lib/mysql
. You can see it by referring to the contents of the file here.
root@55ca40b8744e:~# cd /var/lib/mysql
root@55ca40b8744e:/var/lib/mysql# cat 55ca40b8744.log
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
2020-12-18T17:18:27.044729+09:00 26 Quit
Since I left the MySQL server earlier, it says that I have Quit.
The log when delete
is tried is as follows.
2020-12-18T17:02:09.716428+09:00 67 Prepare DELETE FROM `TABLE` WHERE `table`.`id` = ?
2020-12-18T17:02:09.716513+09:00 67 Execute DELETE FROM `TABLE` WHERE `table`.`id` = 0
Recommended Posts