Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A number of database users have been configured on MySQL Server. Is there a way to log the queries of just one or some specific users and not all queries run on the server.

share|improve this question

migrated from Oct 22 '12 at 1:44

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

You'd have to do this programatically outside of MySQL built in features. MySQL is fairly limited in regards to 'auditing' type logging. In fact, you can't even tell from the existing MySQL binary and query logs 'who' ran the query.

Also, full query logging (not just the binary log) will slow your MySQL server down insanely.

If you want some unverified speculation: Find out if you can trigger on the processlist table. If this is possible you might be able to write a log table with a copy of the entry matching a certain db user My cursory attempts to trigger on anything in information_schema DB hasn't worked, but it might be possible.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.