There are two ways you can log the queries. One way is through general query log, and other way is through slow query log. In this section, you will learn about configuring them.
We will get into the details in the following subsections.
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
:
- Specify the file for logging. If you do not specify, it will be created in the
data directory
with the namehostname.log
. The server creates the file in thedata 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'...