如何配置CentOS7 mariadb服务在崩溃或重启后自动启动

MySql 码拜 6年前 (2017-12-08) 5579次浏览 0个评论
对于centos7 mariadb方式归纳:
重启reboot后自动开启服务
查看是否设置systemd is-enabled mariadb
如果未设置执行:
systemd enable mariadb
crash崩溃后自动启动服务
编辑vi /etc/systemd/system/multi-user.target.wants/mariadb.service
在[Service] 节中增加Restart=always
退出编辑,执行systemctl daemon-reload
测试是否成功设置,
sudo systemctl status mariadb.service
找到pid
Main PID: 661 (mysqld_safe)
杀掉进程 kill -9 661,再次查看服务状态
sudo systemctl status mysqld.service
pid发生变化
Main PID: 11217 (mysqld_safe)
证明启动成功。


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明如何配置CentOS7 mariadb服务在崩溃或重启后自动启动
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!