Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 stackoverflow.com Oct 22 '12 at 1:44

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

1 Answer 1

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

 
discard

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.