MySQL: How to hide queries in the general log

There could be some cases when the general query log has to be kept running. This includes development stage, different flavors of debugging and query analysis and so on. However certain queries do not need to be stored there even though the logging is on. One of the examples is setting user password – it will be logged in clear text.

A possible workaround is to turn off the general logging temporarily. MySQL 5.1 and higher allows to do it without the service restart.

CREATE USER john;
SET SESSION sql_log_off = 1;
SET PASSWORD FOR john = PASSWORD('smith');
SET SESSION sql_log_off = 0;

However SUPER privilege is required to set the session variable sql_log_off.

No Comment

No comments yet

Leave a reply