How to show the last queries executed on MySQL?

Post Reply

Was this article helfull?

One 1 to 5 > 1
0
No votes
One 1 to 5 > 2
0
No votes
One 1 to 5 > 3
0
No votes
One 1 to 5 > 4
0
No votes
One 1 to 5 > 5
1
100%
 
Total votes: 1

User avatar
sonik
Site Admin
Posts: 37
Joined: 12 Nov 2018, 22:12

How to show the last queries executed on MySQL?

Post by sonik » 12 Nov 2018, 22:16

Mysql-screenshot.png
Mysql-screenshot.png (2.54 KiB) Viewed 368 times
You can enable a general query log for that sort of diagnostic. Generally you don't log all SELECT queries on a production server though, it's a performance killer.
Edit your MySQL config, e.g. /etc/mysql/my.cnf - look for, or add, a line like this:

Code: Select all

[mysqld]
log = /var/log/mysql/mysql.log
Restart mysql to pick up that change, now you can:

Code: Select all

tail -f /var/log/mysql/mysql.log
Hey presto, you can watch the queries as they come in.

Post Reply