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

serpent_driver

Well-Known Member
Aug 1, 2019
57
10
8
Home
cPanel Access Level
Root Administrator
Hi there,

I have 2 servers running with WHM/cPanel and with both I have the same problems. Whenever I must reboot my servers because of kernel updates I am notified that mysql appears to be down, but it isn't down. After long research I found what is caused by and found a solution for this issue. It seems to be that mysql can't lock ./ibdata1 when the server will be gracefull restarted.

/var/lib/mysql# mv ibdata1 ibdata1.bak
/var/lib/mysql# cp -a ibdata1.bak ibdata1
/var/lib/mysql# rm ibdata1.bak
This works, but doesn't solves the cause and I am wondering why I am the only one with this problem?! So what is wrong?
 

serpent_driver

Well-Known Member
Aug 1, 2019
57
10
8
Home
cPanel Access Level
Root Administrator
performance-schema=0
default-storage-engine=MyISAM
innodb_file_per_table=1
innodb_buffer_pool_instance=1
max_allowed_packet=268435456
open_files_limit=655350
query_cache_type=1
key_buffer_size=1024k
max_connections=150
max_tmp_tables=1
table_open_cache=60000
local-infile=1
query_cache_limit=512M
thread_cache_size=4
query_cache_size=32M
join_buffer_size=2M
innodb_use_native_aio=0
slow_query_log=0
long_query_time=5
sort_buffer_size=6M
max_heap_table_size=512M
tmp_table_size=512M
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hello,


Thanks for that, if you do the following to use a default generated a mysql configuration file:

Code:
mv /etc/my.cnf{,.bk}
Bash:
/usr/local/cpanel/bin/build_mysql_conf
Code:
/scripts/restartsrv_mysql
Does the issue persist?
 

serpent_driver

Well-Known Member
Aug 1, 2019
57
10
8
Home
cPanel Access Level
Root Administrator
I will try it, but I believe I know what the reason ist. Affected are only innodb databases and they crash sometimes if I do a server restart. For this databases I use local-infile function. A cron is archieving data from Piwik/Matomo and needs local-infile to archieve. I am not not shure, but this could be the reason. To exclude it, it would be necessary to disable mysql server before restart, but don't know how to to disable mysql server without automatic restart. Is ist possible to disable mysql server without automatic restart?
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
To do this you'd need to ensure that chkservd is not set to restart it when it finds it down. You would need to go to WHM>>Service Configuration>>Service Manager -> and disable MySQL from being enabled and monitored. Once that's done you would run:

Code:
/scripts/restartsrv_mysql --stop
Make your changes then restart it with:

Code:
/scripts/restartsrv_mysql --start
Once that's completed don't forget to reenable the service in the Service Manager