Starting or restarting MariaDB results in 900s timeout or hang Print

  • 0

Problem Description

You are restarting MariaDB. All seems to go well, except you get one of the following:

  1. Endless dots repeating for 900s before the startup process completes with no output and returns to the command line.
  2. The systemctl command hangs and ps shows duplicate mysql/mariadb servers running
Problem Resolution 1

The MySQL init script runs the following command in a loop to test whether MariaDB has started successfully or not:

mysqladmin ping

However if there's an entry in /etc/my.cnf or /etc/my.cnf.d/client.conf that it does not like, it will fail and the init script along with it; endlessly looping until its default 900s timeout. Run that command yourself to see what the issue is. In our case it was:
# mysqladmin ping
mysqladmin: unknown variable 'max_allowed_packet=32M'

Removing the max_allowed_packet setting from /etc/my.cnf fixed it. Presumably you could also install that value in the *right* place in /etc/my.cnf.d/ folder if you needed to.

Problem Resolution 2

There is a conflict between the mariadb and mysql namespace in the systemd config. Run the following to ensure systemd recognizes that mysql is an alias to mariadb:

systemctl stop mysql
systemctl stop mariadb
chkconfig --del mysql
systemctl disable mysql
systemctl disable mariadb
systemctl enable mariadb.service
systemctl start mariadb.service

Source

If the above doesn't solve the problem (it should), you can try this too (but this shouldn't be necessary if you do the above):

Check for the existence of path /usr/lib/systemd/system/mariadb.service.d -- within it there is a file that restarts mariadb if its detected as failed. Back up that folder and remove it, then try running systemctl restart mariadb -- it should work now.


Was this answer helpful?

← Back