Monthly Archives: June 2018

Mysql service shows stopped when mysql is running after upgrade

In this case, the upgrade changed a line in the service init script /etc/init.d/mysql from if ! mysqladmin ping &>/dev/null;then to if ! $(mysqladmin --no-defaults --socket="$socket" --user=UNKNOWN_MYSQL_USER ping &>/dev/null) ;then.

Printing out $socket revealed it was empty. That value was coming from /usr/sbin/mysqld --print-defaults, which prints out the the configuration defined in the config file. I had not defined socket in my config file (instead just using mysql default socket location), so adding the line socket=/var/run/mysqld/mysqld.sock to /etc/mysql/my.cnf solved the problem.