I have a problem with the mysql query-log.
I searched the used my.cnf with https://stackoverflow.com/a/2896718/1012683 and added the line log=/var/log/mysqld_query.log to my.cnf. Then I restartet mysql but there is still no query-log.
Whats wrong here?
Thanks, Flo
To disable or enable the general query log or change the log file name at runtime, use the global general_log and general_log_file system variables. Set general_log to 0 (or OFF ) to disable the log or to 1 (or ON ) to enable it.
The general query log is a log of every SQL query received from a client, as well as each client connect and disconnect. Since it's a record of every query received by the server, it can grow large quite quickly.
The error log is located in the data directory specified in your my. ini file. The default data directory location is C:\Program Files\MySQL\MySQL Server 8.0\data , or C:\ProgramData\Mysql on Windows 7 and Windows Server 2008.
You need to set general_log
to 'ON'. see here
Add this in my.cnf
and then restart MySQL server:
general_log = 1
log=/var/log/mysqld_query.log
or
SET GLOBAL general_log = 'ON';
You can check whether the general_log is 'ON' or 'OFF' first using query:
mysql>show variables like '%log%';
if the general_log is 'OFF', then the setting of log=... will not work. The general_log can be turn on when mysql is running (do not need to restart mysql) using cmd below:
mysql>SET GLOBAL general_log = 'ON';
And the log file in variable general_log_file will be auto generated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With