MySQL General log does not start with 'Set Global'

I am trying to set up my MySQL general log so that it can be turned on and off with

SET GLOBAL general_log = 'ON'
SET GLOBAL general_log = 'OFF'


I would like this by default (i.e. when starting the server), but then it can be toggled as above so that I don't have to restart the server. When I try to enable shared login as above, MySQL generates the following error:

Table 'mysql.general_log' doesn't exist


That's right - I didn't create this table on purpose as I would like the logging to happen to the file - NOT the tables. This tells me that MySQL is trying to write general queries to the table, even if the corresponding globals are set like this:

log_output = FILE
general_log = OFF
general_log_file = /var/log/mysql-general.log


The relevant part of my.cnf looks like this:

general-log = OFF
general-log-file = /var/log/mysql-general.log


I am using MySQL version 5.1.58 on a Linux server.

Thanks in advance,



source to share

1 answer

Since the table mysql.general_log

does not exist, I am assuming you have upgraded from a previous MySQL version and need to run mysql_upgrade to create them.

Back up all your databases using mysqldump

and back up the filesystem/var/lib/mysql

, then run the following commands:

mysql_upgrade -p --force 


followed by

service mysql restart



/etc/init.d/mysql restart


If after following these steps the general_log table does not exist, follow the steps in this post: MySql - I omitted the general_log table to manually create it.



All Articles