Description:
mysqld_safe included in the MySQL Community 5.6 packages for CentOS 6 ignores configuration options in the [mysqld_safe] section of my.cnf.
Here are the packages I'm using:
[gmontee@localhost ~]$ yum list "mysql-community*"
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirror.sanctuaryhost.com
* epel: mirrors.einstein.yu.edu
* extras: mirror.lug.udel.edu
* updates: mirror.symnds.com
Installed Packages
mysql-community-client.x86_64 5.6.23-2.el6 @MySQL5.6
mysql-community-common.x86_64 5.6.23-2.el6 @MySQL5.6
mysql-community-devel.x86_64 5.6.23-2.el6 @MySQL5.6
mysql-community-libs.x86_64 5.6.23-2.el6 @MySQL5.6
mysql-community-server.x86_64 5.6.23-2.el6 @MySQL5.6
Available Packages
mysql-community-bench.x86_64 5.6.23-2.el6 MySQL5.6
mysql-community-client.i686 5.6.23-2.el6 MySQL5.6
mysql-community-common.i686 5.6.23-2.el6 MySQL5.6
mysql-community-devel.i686 5.6.23-2.el6 MySQL5.6
mysql-community-embedded.i686 5.6.23-2.el6 MySQL5.6
mysql-community-embedded.x86_64 5.6.23-2.el6 MySQL5.6
mysql-community-embedded-devel.i686 5.6.23-2.el6 MySQL5.6
mysql-community-embedded-devel.x86_64 5.6.23-2.el6 MySQL5.6
mysql-community-libs.i686 5.6.23-2.el6 MySQL5.6
mysql-community-libs-compat.i686 5.6.23-2.el6 MySQL5.6
mysql-community-libs-compat.x86_64 5.6.23-2.el6 MySQL5.6
mysql-community-release.noarch el6-5 MySQL5.6
mysql-community-test.x86_64 5.6.23-2.el6 MySQL5.6
[gmontee@localhost ~]$ rpm -q --file /etc/init.d/mysqld
mysql-community-server-5.6.23-2.el6.x86_64
How to repeat:
The easiest way to see if a section is being ignored is to define an option that should cause the server to abort startup.
So let's do that for [mysqld_safe]:
[gmontee@localhost ~]$ sudo tee /etc/my.cnf <<EOF
> [mysqld_safe]
> bad-option
> EOF
[mysqld_safe]
bad-option
And now try to start the server:
[gmontee@localhost ~]$ sudo mysqld_safe --user=mysql &
[1] 12524
[gmontee@localhost ~]$ 150217 10:06:05 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
150217 10:06:05 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
And it works:
[gmontee@localhost ~]$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> \q
Bye
Now stop the server, and put the bad option in [mysqld] instead:
[gmontee@localhost ~]$ mysqladmin -u root shutdown
150217 10:07:01 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
[1]+ Done sudo mysqld_safe --user=mysql
[gmontee@localhost ~]$ sudo tee /etc/my.cnf <<EOF
> [mysqld]
> bad-option
> EOF
[mysqld]
bad-option
Now start the server the same way and it fails as expected:
[gmontee@localhost ~]$ 150217 10:08:11 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
150217 10:08:11 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150217 10:08:13 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
[1]+ Done sudo mysqld_safe --user=mysql
[gmontee@localhost ~]$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Suggested fix:
mysqld_safe should use options specified in the [mysqld_safe] group.