Bobcares

MySQL down but running as mysqld_safe | How to fix

by | Nov 30, 2021

MySQL down but running as mysqld_safe can be resolved with this handy tip from Bobcares.

At Bobcares, we offer solutions for every query, big and small, as a part of our Server Management Service.

Let’s take a look at how our Support Team recently helped a customer when their MySQL was down but running as mysqld_safe.

Is MySQL down but running as mysqld_safe?

Has your cPanel & WHM software been reporting that your MySQL is down?

# /usr/local/cpanel/scripts/restartsrv_mysql --status
(XID l35tte) The “mysql” service is down.

However, when you verify, you notice that mysqld_safe is running.

# ps fauxww | grep mysq[l]
root 1030 0.0 0.1 113632 1593 ? S 12:31 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/host.hostname.tld.pid
mysql 1134 0.0 8.7 1305384 88427 ? Sl 12:31 0:01 \_ /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/host.hostname.tld.err --open-files-limit=10000 --pid-file=/var/lib/mysql/$hostname.pid

mysqld_safe is a safe way to start a MySQL server after an error occurs. Moreover, it adds a few safety features while restarting the server after an error. In this particular scenario, MySQL safe mode is a clear indication that an error is present.

According to our Support Team, this often occurs in MariaDB versions ranging between 10.4.4 and 10.1.7 on EL7. Furthermore, it causes a race condition between the init script and systemd, resulting in this specific issue.

In other words, sometimes MySQL gets rebooted along with mysqld_safe when it actually should not.

Fortunately, our Support Team has a solution for this issue. First, we need to ensure that MariaDB is enabled with the following command:

systemctl enable mariadb

For instance,

# systemctl enable mariadb
Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

 

Next, we will stop MySQL and restart it with the restartsrv script as seen below:

/usr/local/cpanel/scripts/restartsrv_mysql --stop
/usr/local/cpanel/scripts/restartsrv_mysql –start

This workaround will help us have MySQL up and running without any trouble. Interestingly, two other upstream bug cases are also related to this particular issue.

[Looking for assistance with another query? We are just a click away.]

Conclusion

In short, the skilled Support Engineers at Bobcares demonstrated how to enable quotas on UEFI systems without running into any further errors.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.