HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to enable queries logs in MariaDB

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
enablelogshowqueriesmariadb

Problem

I'm running mysql Ver 15.1 Distrib 5.5.46-MariaDB in CentOS 6.7 server. I'm trying to get queries logged and I'm doing by redirecting log to files as shown below:

#/etc/my.cnf.d/server.cnf
# this is only for the mysqld standalone daemon
[mysqld]
#
# * Fine Tuning
#
key_buffer              = 16M
max_allowed_packet      = 512M
thread_stack            = 192K
thread_cache_size       = 8

log-output = FILE

#General Query Log
general_log
general_log_file        = /var/log/mysql/mysql_query.log

#Error Log
log_error               = /var/log/mysql/mysql_error.log

#Slow Query Log
log-slow-queries
slow_query_log          = 1
slow_query_log_file     = /var/log/mysql/mysql_slow.log
long_query_time         = 2
log-queries-not-using-indexes

collation-server = utf8_general_ci
init-connect='SET NAMES utf8'
character-set-server = utf8


Before restart MySQL service I did run the following command to create each file and assign proper permissions:

mkdir -p /var/log/mysql && touch /var/log/mysql/mysql_query.log && touch /var/log/mysql/mysql_error.log && touch /var/log/mysql/mysql_slow.log && chown -R mysql:mysql /var/log/mysql/


I have restarted the MySQL daemon:

service mysql restart


After restart the MySQL server I can see the files but with 0 size so MySQL is not sending anything to those files. I did run the following query on MySQL console SHOW VARIABLES LIKE '%log%' and below is the result and as you may notice changes are not made at server:

```
+-------------------------------------------+--------------------------------------------------------------------------------------------------------------+
| Variable_name | Value |
+-------------------------------------------+--------------------------------------------------------------------------------------------------------------+
| aria_checkpoint_log_activity

Solution

Ok, finally I found where the issue was! For some reason I delete /etc/my.cnf file (perhaps when I uninstall MySQL or something else) and that's the file including everything under /etc/my.cnf.d because of that changes don't take effect. My bad. Thanks for your time

Context

StackExchange Database Administrators Q#98732, answer score: 2

Revisions (0)

No revisions yet.