Mysql – How to active mariadb log

linuxmariadbMySQL

I want active log file in mariadb for check last query used in php, i find mysql config in internet like as blow:

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

or

log = /var/log/mysql/mysql.log

I added this config in /etc/mysql/my.cnf and [mysql] section and restart mariadb service.
but i didn't get any log, how to fix this?

i find answer:

[mysqld]
...
log_output = FILE
general_log = ON
general_log_file = mysql.log

mysql.log save in datadir, run SHOW VARIABLES WHERE variable_name = 'datadir' in mariadb to get datadir.

Best Answer

You also need one of these:

log_output = FILE

log_output = TABLE

And put them in this section:

[mysqld]

('d' as in 'daemon' as in the 'server')