重启mysql找不到mysql.service,原来是使用了MariaDB管理MySQL

我的/etc/my.cnf配置为

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
#skip-grant-tables


[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid


#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

今天需要重启MySQL,不过找了没找好久也没有到mysql.service文件,最后服务器是利用MariaDB来管理MySQL。
查看系统的服务列表

systemctl list-dependencies
image.png

使用mariadb.service代替mysql.service或mysqld.service来重启mysql

service mariadb.service restart
service mariadb.service start
service mariadb.service stop

或者可以这样做:

systemctl restart mariadb.service
systemctl start mariadb.service
systemctl stop mariadb.service

然后你就可以去修改mysql的账号密码等操作了

你可能感兴趣的:(重启mysql找不到mysql.service,原来是使用了MariaDB管理MySQL)