MySQL enabling the query log for the root user only

auditloggingMySQLSecurity

I want to an audit log for a particular user/connection and not the application itself. Anytime a client manually connects to the server with specific credentials, I want the query log, and binary log to be enabled.

Is this possible, how would I activate the log for only that user/connection while ignoring the statements run by the application?

Thanks,

Walter

Best Answer

There aren't any options to control such granularity. The general query log is either on or off. The binary log can include or exclude particular databases, but that's all.

Possibly the best you can do to obtain this information is to parse the log files retroactively with tools like mysqlsla or mysql-log-filter. Beware though, as you might already be, that the general query log can be a cause of I/O contention in production environments.