Mysql – Percona MySQL 5.5.33 not reading the.cnf

MySQLperconaredhat

At some point Percona MySQL on CentOS 6.4 seems to have stopped reading my.cnf, possibly after MySQL updated to 5.5.33 a few days ago.

Selection from /etc/my.cnf:

[mysqld]

# GENERAL #
user                    = mysql
default-storage-engine  = InnoDB
socket                  = /var/lib/mysql/mysql.sock
pid_file                = /var/run/mysql.pid
symbolic-links          = 0 

# CHARACTER SET AND COLLATION #
collation-server        = utf8_unicode_ci
character-set-server    = utf8
init-connect            = 'SET NAMES utf8'
init-connect            = 'SET collation_connection = utf8_unicode_ci'

# DATA STORAGE AND LOGGING #
datadir                 = /var/lib/mysql
tmpdir                  = /tmp
slow_query_log_file     = mysql-slow.log
slow_query_log          = 1 
long_query_time         = 8 
log_error               = mysql-error.log

# CACHES AND LIMITS #
max_connections         = 250
max_connect_errors      = 10000
open_files_limit        = 20000
back_log                = 100
wait_timeout            = 10800
interactive_timeout     = 600
max_allowed_packet      = 256M
tmp_table_size          = 512M
max_heap_table_size     = 64M 
query_cache_size        = 32M
thread_cache_size       = 64

Some output from 'mysqld –help –verbose'

log-error                                         mysql-error.log
slow-query-log                                    TRUE
slow-query-log-file                               mysql-slow.log
max-connections                                   250
max-heap-table-size                               67108864

Ok that seems good, matches my config. How about logging into mysql and doing some SHOW VARIABLES:

log_error   /var/lib/mysql/hostname.err
log_slow_queries    OFF
slow_query_log_file /var/lib/mysql/hostname-slow.log
max_connections 151
max_heap_table_size 16777216

Huh, well that ain't right. Slow log is off, error log has the wrong name, connection and heap sizes are wrong, and the server collation is wrong as well.

Processes running

root     23533     1  0 12:32 pts/3    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/hostname.pid
mysql    23624 23533 91 12:32 pts/3    01:05:32 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/hostname.err --pid-file=/var/lib/mysql/hostname.pid

I see the error log listed in the process has the wrong name right off the bat. I've tried manually restarting mysql from /etc/init.d, via 'service mysql restart', via restarting the entire server. Nothing seems to get MySQL to read the conf.

Maybe something is breaking when mysqld_safe spins up a mysql instance? No problems reported in the error log when the server starts. Any ideas?

Best Answer

Ultimately the problem was SELinux on CentOS, and the answer was to disable SELinux! I couldn't find any errors in the SELinux log related to MySQL so this took quite some time to track down.