0

MySQL can log all queries in what is called "General Log"

Is there a way to keep this query log but skip all queries for a specific user? Or maybe for a specific database?


I would like so because I have a database that one user connects to (application user), so I want to have the query log to make debug easier in staging area, but I also have a daemon that connects to this same database with another user, and daemon issues like 1 query per second. So my query logs are 80% filled by this daemon's query so I would like to skip them to make it easier to find app user's queries.

3
  • The general_log server setting's scope is GLOBAL only. You cannot disable it for a separate connection (account) and/or for a separate database.
    – Akina
    Commented Jul 15, 2019 at 11:16
  • See if pt-query-digest can help in looking at the file.
    – Rick James
    Commented Jul 15, 2019 at 13:39
  • @RickJames AH, neat for those who use Percona. But I don't when developping on local environment (sounds a bit heavy for that). I'm simply viewing the logs with cat or tail or plain text editor, hence my willing to have mysql not put these query into the file (rather than filter when displaying the file, tho I could do cat file.log | grep -v 'table_name_or_schema_name')
    – Xenos
    Commented Jul 16, 2019 at 13:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.