How do I enable the MySQL function that logs each SQL query statement received from clients and the time that query statement has submitted? Can I do that in phpmyadmin or N
In phpMyAdmin 4.0, you go to Status > Monitor. In there you can enable the slow query log and general log, see a live monitor, select a portion of the graph, see the related queries and analyse them.
// To see global variable is enabled or not and location of query log
SHOW VARIABLES like 'general%';
// Set query log on
SET GLOBAL general_log = ON;
This was already in a comment, but deserves its own answer: Without editing the config files: in mysql, as root, do
SET global general_log_file='/tmp/mysql.log';
SET global log_output = 'file';
SET global general_log = on;
Don't forget to turn it off afterwards:
SET global general_log = off;
You can disable or enable the general query log (which logs all queries) with
SET GLOBAL general_log = 1 # (or 0 to disable)
for mysql>=5.5 only for slow queries (1 second and more) my.cfg
[mysqld]
slow-query-log = 1
slow-query-log-file = /var/log/mysql/mysql-slow.log
long_query_time = 1
log-queries-not-using-indexes
I also wanted to enable the MySQL log file to see the queries and I have resolved this with the below instructions
/etc/mysql/mysql.conf.d
and enable the below lines
general_log_file = /var/log/mysql/mysql.log
general_log = 1
/etc/init.d/mysql restart
/var/log/mysql/
and check the logs