Mysql – thesql log Queries for specific user

loggingMySQL

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.

Best Answer

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.