instanceOfObject
instanceOfObject

Reputation: 2984

Last query fired on MySQL

I want to know the last query that was fired on mySQL server, or the host it was fired from. Any better way to do it?

Upvotes: 1

Views: 1308

Answers (2)

Roman Newaza
Roman Newaza

Reputation: 11700

SET GLOBAL log_output = 'TABLE'

SET GLOBAL general_log = 'ON'

look to table mysql.general_log

Upvotes: 2

Maxim Krizhanovsky
Maxim Krizhanovsky

Reputation: 26719

Since enabling logging of all queries will kill performance, you can create a proxy and keep the last query there. Or if you can afford changing the application code, alter the DB layer in a way that it stores the last executed query in memory (memcached for example)

Upvotes: 3

Related Questions