Disable MySQL general logging without restarting?

19,358

For anyone using 5.1 now, you can use these commands (had to look them up and this Q&A came up)

SET GLOBAL log_output='TABLE'; #or FILE

SET GLOBAL general_log='OFF'; #or ON

SET GLOBAL slow_query_log='ON'; #or OFF

TABLE will store them in the mysql.general_log and mysql.slow_log tables instead of files which is nice in development for reviewing and truncating.

Share:
19,358
shantanuo
Author by

shantanuo

open source contributor

Updated on June 12, 2022

Comments

  • shantanuo
    shantanuo almost 2 years

    Can I disable general logging completely without restarting the server?

    Because, per the documentation:

    SET sql_log_bin = {0|1}
    

    Disables or enables binary logging for the current connection (sql_log_bin is a session variable) if the client has the SUPER privilege. The statement is refused with an error if the client does not have that privilege.

    Can I enable/disable general log without restarting MySQL?

  • zeflex
    zeflex over 9 years
    Thanks for informations. Are the confs saved after a server reboot ?
  • timetofly
    timetofly over 9 years
    @zeflex no, you have to add it to the my.cnf file to keep the settings.