Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unknown variable 'general_log_file=/var/log/mysql/mysql.log'

Tags:

mysql

mariadb

I'm using MySQL / 10.1.29-MariaDB-6 on Kali Linux 2018 VM.

I have the following entry in mariadb.cnf, mysql.cnf, and 50-server.cnf.

general_log_file    = /var/log/mysql/mysql.log
general_log         = 1

The conf file shows that the following config files are used to determine options:

The MariaDB/MySQL tools read configuration files in the following order:

  1. /etc/mysql/mariadb.cnf (this file) to set global defaults,
  2. /etc/mysql/conf.d/*.cnf to set global options.
  3. /etc/mysql/mariadb.conf.d/*.cnf to set MariaDB-only options.
  4. ~/.my.cnf to set user-specific options.

Logging IS working to the file specified, but whenever I try to type the following mysql command, I am met with the following error:

root@kali:/var/log/mysql# mysql -u root -p

mysql: unknown variable 'general_log_file=/var/log/mysql/mysql.log'

How to fix this error?

like image 912
CodingNovice Avatar asked Oct 16 '25 15:10

CodingNovice


1 Answers

Check the sections of the config file(s) where general_log_file option is set. It must be [mysqld], or [server], or [mariadb] and alike, but it must not be [mysql] or [client] or alike. general_log_file is a server-only option.

like image 90
elenst Avatar answered Oct 18 '25 09:10

elenst



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!