General query log

As per the MySQL documentation:

The general query log is a general record of what mysqld is doing. The server writes information to this log when clients connect or disconnect, and it logs each SQL statement received from clients. The general query log can be very useful when you suspect an error in a client and want to know exactly what the client sent to mysqld:

  1. Specify the file for logging. If you do not specify, it will be created in the data directory with the name hostname.log. The server creates the file in the data directory unless an absolute path name is given to specify a different directory:
mysql> SET @@GLOBAL.general_log_file='/var/log/mysql/general_query_log';Query OK, 0 rows affected (0.04 sec)
  1. Enable ...

Get MySQL 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.