systemctl start mysqld fails with timeout if custom path for socket specified

Bug #1534825 reported by Sveta Smirnova on 2016-01-15
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to
Fix Released
Tomislav Plavcic
Fix Released
Tomislav Plavcic
Fix Released
Tomislav Plavcic

Bug Description

Fedora 23 Linux evl-db-01 4.2.7-300.fc23.x86_64 #1 SMP Wed Dec 9 22:28:30 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Percona Server 5.6.28:

If customer uses default socket location (/var/lib/mysql/mysql.sock) ans runs command `systemctl restart mysqld`, systemctl finishes with success.

But if specifies custom path to socket (/opt/evl-db1-data/mysql/mysql.sock) command fails with error: "Job for mysqld.service failed because a timeout was exceeded. See "systemctl status mysqld.service" and "journalctl -xe" for details."

However mysqld actually started.

Tags: pkg Edit Tag help
tags: added: pkg
Przemek (pmalkowski) wrote :

I did this change to verify this report:


And indeed systemctl timeouts after the change:

[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

[root@localhost ~]# systemctl start mysqld
Job for mysqld.service failed because a timeout was exceeded. See "systemctl status mysqld.service" and "journalctl -xe" for details.

[root@localhost ~]# systemctl status mysqld
* mysqld.service - MySQL Percona Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: activating (start-post) since Mon 2016-01-18 09:21:30 EST; 6min ago
  Process: 6734 ExecStartPre=/usr/bin/mysql-systemd pre (code=exited, status=0/SUCCESS)
 Main PID: 6763 (mysqld_safe); : 6764 (mysql-systemd)
   CGroup: /system.slice/mysqld.service
           |-6763 /bin/sh /usr/bin/mysqld_safe
           |-6982 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/err.log --open-files-limit=548000 --pid-file=/var/lib/mysql/localhost.localdomain.p...
             |-6764 /bin/bash /usr/bin/mysql-systemd post
             `-8065 sleep 1

Jan 18 09:21:30 localhost.localdomain systemd[1]: Starting MySQL Percona Server...
Jan 18 09:21:31 localhost.localdomain mysqld_safe[6763]: 160118 09:21:31 mysqld_safe Logging to '/var/lib/mysql/err.log'.
Jan 18 09:21:31 localhost.localdomain mysqld_safe[6763]: 160118 09:21:31 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

[root@localhost ~]# ps -ef|grep mysqld
root 6763 1 0 09:21 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe
mysql 6982 6763 0 09:21 ? 00:00:02 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/err.log --open-files-limit=548000 --pid-file=/var/lib/mysql/ --socket=/tmp/mysql.sock
root 8466 11972 0 09:29 pts/2 00:00:00 grep --color=auto mysqld

Server version: 5.6.28-76.1 Percona Server (GPL), Release 76.1, Revision 5759e76

But so was failing the mysql client who still tries to connect to default socket.. But when I also added this to my.cnf:



the systemctl start mysqld works just fine.

Tomislav Plavcic (tplavcic) wrote :

The above fix is for centos7, but the issue has been confirmed on ubuntu trusty also - so debian packaging needs to be updated as well - thus reopening this bug.
I don't think it affects centos 5/6 but it should be tested.

Tomislav Plavcic (tplavcic) wrote :

Made further checks, centos 6 is not affected and ubuntu is not affected also although I wrote in my previous comment that it was but I missed one thing.
So on ubuntu you have to change socket option in debian.cnf as well as in my.cnf since in debian/ubuntu that second config file debian.cnf is used for administrative stuff.

Here's proof that it works when you change it properly in all places:
vagrant@t-ubuntu1404-64:~$ sudo /etc/init.d/mysql start
 * Starting MySQL (Percona Server) database server mysqld
 * Checking for corrupt, not cleanly closed and upgrade needing tables.

vagrant@t-ubuntu1404-64:~$ ps aux|grep mysql
root 11302 0.0 0.0 4444 192 pts/0 S 02:49 0:00 /bin/sh /usr/bin/mysqld_safe
mysql 11635 4.3 88.2 1164528 442600 pts/0 Sl 02:49 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/ --socket=/tmp/mysqld.sock --port=3306

vagrant@t-ubuntu1404-64:~$ sudo cat /etc/mysql/my.cnf |grep socket
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
socket = /tmp/mysqld.sock
socket = /tmp/mysqld.sock
socket = /tmp/mysqld.sock

vagrant@t-ubuntu1404-64:~$ sudo cat /etc/mysql/debian.cnf |grep socket
socket = /tmp/mysqld.sock
socket = /tmp/mysqld.sock

vagrant@t-ubuntu1404-64:~$ sudo /etc/init.d/mysql stop
 * Stopping MySQL (Percona Server) mysqld

vagrant@t-ubuntu1404-64:~$ ps aux|grep mysql
vagrant 11819 0.0 0.1 11744 912 pts/0 S+ 02:51 0:00 grep --color=auto mysql

Percona now uses JIRA for bug reports so this bug report is migrated to:

Sizwan Ahammed (sizwan) wrote :

Reinstalling MySQL might help:

First uninstall the current MySQL
Then delete /var/lib/mysql and /etc/mycnf or /etc/mycng.rpmsave
Reboot the machine
Now install the MySQL again.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers