mysqld_safe not run on RHEL7, while it runs on RHEL6 when starting mariadb
-
03-10-2020 - |
题
I see this strange behavior when Mariadb is run on RHEL7 and RHEL6.
When I start the mariadb server on RHEL6 via service mysql start
, I see mysqld_safe
starts along with mysqld
.
[user@divinedragon]# service mysql start
Starting mysql (via systemctl): [ OK ]
[user@divinedragon]# ps aux | grep mysql
root 2398 0.0 0.0 115372 1712 ? S 09:26 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/divinedragon.pid
mysql 2472 2.8 3.4 798208 134576 ? Sl 09:26 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/divinedragon.err --pid-file=/var/lib/mysql/divinedragon.pid
root 2503 0.0 0.0 112644 956 pts/0 S+ 09:27 0:00 grep --color=auto mysql
However, when I do the same thing on RHEL7, I don't see any mysqld_safe
process coming up. Here is the ouput from RHEL 7.
[user@divinedragon ~]$ sudo service mysql start
Starting mysql (via systemctl): [ OK ]
[user@divinedragon ~]$ ps aux | grep mysql
mysql 2515 2.6 6.0 774616 114412 ? Ssl 08:51 0:00 /usr/sbin/mysqld
user 2548 0.0 0.0 112644 952 pts/0 R+ 08:51 0:00 grep --color=auto mysql
Can somebody shed some light in here?
解决方案
It is stated in the mariadb and even mysql docs:
https://mariadb.com/kb/en/mariadb/systemd/
systemd services are packaged on RPM and Debian based Linux distributions. When systemd is used, mysqld_safe is not used and settings in the mysqld_safe section of configuration files will not be read or applied.
https://dev.mysql.com/doc/refman/5.7/en/server-management-using-systemd.html
On platforms for which systemd support is installed, scripts such as mysqld_safe and the System V initialization script are not installed because they are unnecessary. For example, mysqld_safe can handle server restarts, but systemd provides the same capability, and does so in a manner consistent with management of other services rather than using an application-specific program.