MariaDB The service “mysql” appears to be down but it isn't

Michael Legg

Well-Known Member
Mar 2, 2015
90
6
58
New Farm, Queensland, Australi
cPanel Access Level
Website Owner
WHM send me an email every hour saying ...


Notification​
The service "mysql" appears to be down.​
Service Check Method​
The system's command to check or to restart this service failed.​
Number of Restart Attempts​
3,860​
Service Check Raw Output​
(XID a39xhq) The "mysql" service is down.

The subprocess "/usr/local/cpanel/scripts/restartsrv_mysql" reported error number 2 when it ended.​
Startup Log​
Oct 22 11:55:23 xxxxxx systemd[1]: Started MySQL Server.
Oct 22 11:55:23 xxxxxx mysqld_safe[29486]: /usr/bin/mysqld_safe: line 616: /xxxxxx.err: Permission denied
Oct 22 11:55:23 xxxxxx mysqld_safe[29486]: 201022 11:55:23 mysqld_safe error: log-error set to '/xxxxxx.​

But it isn't down.

I'm running WHM 90.0.15 and MariaDB 10.4.12

Is there a fix for this?
 

andrew.n

Well-Known Member
Jun 9, 2020
982
363
63
EU
cPanel Access Level
Root Administrator
Michael, see the startup log. The error is this:

/usr/bin/mysqld_safe: line 616: /xxxxxx.err: Permission denied

You need to fix the permission on the log files. It's probably not owned by mysql user.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
So, when you switch to MariaDB you would still run /scripts/restartsrv_mysql and it should restart MariaDB but in this instance, it looks like it's actually attempting to start MySQL. On my server with MariaDB:

Code:
[root@server dev]# /scripts/restartsrv_mysql
Waiting for “mysql” to restart ……waiting for “mysql” to initialize ………finished.

Service Status
    mariadb (/usr/sbin/mysqld) is running as mysql with PID 9657 (systemd+/proc check method).

Startup Log
    Oct 23 13:14:11 server.myhostname.us systemd[1]: Starting MariaDB 10.3.25 database server...
    Oct 23 13:14:11 server.myhostname.us mysqld[9657]: 2020-10-23 13:14:11 0 [Note] /usr/sbin/mysqld (mysqld 10.3.25-MariaDB) starting as process 9657 ...
    Oct 23 13:14:11 server.myhostname.us systemd[1]: Started MariaDB 10.3.25 database server.

mysql restarted successfully.
Note specifically in the log messages it notes that it indicates MariaDB as the Database Server. This seems to indicate that there are some changes/customizations that have occurred on the server. I'd suggest you open a ticket if this issue is still occurring to have this investigated further.
 

Michael Legg

Well-Known Member
Mar 2, 2015
90
6
58
New Farm, Queensland, Australi
cPanel Access Level
Website Owner
Thanks Lauren.
Before I open a ticket, there are 2 factors that may have a bearing:
(1) The MariaDB server is remote not local.
(2) The MariaDB logs are encrypted.
Is there something special I need to do to enable cPanel to cope with this situation?
 
Last edited:

andrew.n

Well-Known Member
Jun 9, 2020
982
363
63
EU
cPanel Access Level
Root Administrator
cPanel is trying to start the local MariaDB server so if you are using a remote one then you are troubleshooting the wrong one?!
 

andrew.n

Well-Known Member
Jun 9, 2020
982
363
63
EU
cPanel Access Level
Root Administrator
You can add multiple remote hosts to the server and it actually doesn't mean that you can't have a locally running SQL server as well. If you want to get this disable you can do so under Service Manager and you won't get notification about that anymore.
 

Michael Legg

Well-Known Member
Mar 2, 2015
90
6
58
New Farm, Queensland, Australi
cPanel Access Level
Website Owner
You can add multiple remote hosts to the server and it actually doesn't mean that you can't have a locally running SQL server as well. If you want to get this disable you can do so under Service Manager and you won't get notification about that anymore.
I've disabled database monitoring under Service Manager, so the emails have stopped. but it would be better if cPanel could monitor remote database servers. I've also noticed cPanel is unable to upgrade remote database servers, so you lose a lot of functionality when you choose to run your database on a separate server.
 

Michael Legg

Well-Known Member
Mar 2, 2015
90
6
58
New Farm, Queensland, Australi
cPanel Access Level
Website Owner
Michael, see the startup log. The error is this:

/usr/bin/mysqld_safe: line 616: /xxxxxx.err: Permission denied

You need to fix the permission on the log files. It's probably not owned by mysql user.
line 616 of /usr/bin/mysqld_safe: points to a variable called $err_log, but I can't find where the variable is set in that script, so I don't know what file to give it ownership of.
 

andrew.n

Well-Known Member
Jun 9, 2020
982
363
63
EU
cPanel Access Level
Root Administrator
cPanel doesn't have a way to access the remote server hence it can't offer such functionality. The error log file is specified in /etc/my.cnf but the error message says where the .err is located.
 
  • Like
Reactions: cPRex