0

I have MariaDB 10.1.22 installed on Mac OSX 10.2.

my.cnf is located in /usr/local/etc/my.cnf (it does use that file).

This is an example of my default my.cnf

#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

#
# include all files from the config directory
#
!includedir /usr/local/etc/my.cnf.d

If I add the following line:

general_log = 1

or:

general-log = 1

I restart mysql and it fails with the following output:

unknown variable 'general_log=on'

or:

unknown variable 'general-log=on'

I have researched this on the mariadb site and it tells me to use the 'general_log' syntax, However that does not work.

I have noticed that the 'group':

[client-server]

is read by both client and server, Could that be the issue? If so what is the correct syntax to enable the general log within my.cnf?

Thanks in advance.

UPDATE: When I attempt to add another group for example the 'mysql' group:

#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[mysqld]
general-log = 1
#[client-server]
#!includedir /usr/local/etc/my.cnf.d

I then restart the mysql server and I receive the following output error:

ERROR 1049 (42000): Unknown database 'restart'

This happens when I enter '[mariadb]' too. Incorrect group tags maybe?

Adamski
  • 839
  • 2
  • 10
  • 28

1 Answers1

0

general-log option should be added to [mysqld] section or [mariadb] section of the config file (you can create one if they're not there):

[mysqld]
general-log = 1

Clients don't recognize it. The startup probably runs mysql or mysqladmin which pick up the config option and throw the error.

elenst
  • 3,839
  • 1
  • 15
  • 22
  • when I add any group variation you have suggested , I get the following error output when I start mysql: ERROR 1049 (42000): Unknown database 'restart' – Adamski Aug 09 '17 at 13:30
  • It has nothing to do with general log. But if it didn't happen before and only started happening now, maybe there is something in `!includedir /usr/local/etc/my.cnf.d` that made a difference. You didn't need to comment those two lines, `[client-server]` and `!includedir /usr/local/etc/my.cnf.d` , uncomment them back and try again. But if you didn't try before, and if it keeps happening even with the old config, then more likely you have a problem with your scripts or procedure. Like, for example, you run `mysql restart` rather than `/etc/init.d/mysql restart` or service restart. – elenst Aug 09 '17 at 15:10
  • never used the general log before on mac osx. I have uncommented those 2 lines and tried again to no avail. mysql successfully starts , stops and restarts via the commands I use, as long as the newly added 'general_log' variables are not added. Its only when I add any variation of those variables or groups that mysql fails to start and shows the error output. – Adamski Aug 09 '17 at 15:17
  • Show the whole output, where and when exactly are you getting this error? (`ERROR 1049`) – elenst Aug 09 '17 at 15:23
  • I have provided the whole output in the comment earlier and as an update in description. The error occurs after I restart the mysql server to initiate the newly added group for the general-log variable, I used what yourself suggested [mysqld] and [mariadb]. – Adamski Aug 09 '17 at 15:35