当前位置:   article > 正文

systemctl添加mysql服务_systemctl中配置使用mysqld脚本启动服务 type怎么写

systemctl中配置使用mysqld脚本启动服务 type怎么写

背景
之前一直是用的Centos6/RHEL6版本的OS,现在7比较普遍了,systemd变主流了。

目标
MySQL装好了,关机保护,先停DB

步骤
1 创建.service文件的路径

/usr/lib/systemd/system/
  • 1

2 创建启动文件.service结尾

root@xxx:~# cat /usr/lib/systemd/system/mysql3308.service
[Unit]
Description=MySQL3308
SourcePath=/etc/init.d/mysql3308
Before=shutdown.target # 关机前操作

[Service]
User=mysql # 此用户必须存在,即为启动mysql的用户
Type=forking
ExecStart
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/喵喵爱编程/article/detail/960607
推荐阅读
相关标签
  

闽ICP备14008679号