CentOS7中将Mysql添加为系统服务
时间:2021-07-01 10:21:17
帮助过:2人阅读
=
Mysql
After=syslog.target network.target remote-fs.target nss-
lookup.target
[Service]
Type=
forking
PIDFile=/usr/local/mysql/data/XXX
.pid
ExecStart=/usr/local/mysql/support-files/
mysql.server start
ExecReload=/bin/
kill -
s HUP $MAINPID
ExecStop=/bin/
kill -
s QUIT $MAINPID
PrivateTmp=
false
[Install]
重新载入单元,扫描新的或有变化的单元,使刚刚添加的mysql.service生效
systemctl daemon-reload
此后,则可通过如下命令操作Mysql
systemctl enable mysql
systemctl start mysql
systemctl stop mysql
systemctl restart mysql
如上四条命令分别为:
- 设为开机启动
- 启动
- 停止
- 重启
CentOS7中将Mysql添加为系统服务
标签: