vim /usr/lib/systemd/system/mysqld.service
写入system配置:
[Unit]
Description=MySQL Server
Documentation=mysqld
##mysql参考手册
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/data/mysql/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000
重读systemd:
systemctl daemon-reload
启动服务,查看启动状态,并设置开机自启:
systemctl start mysqld.service
systemctl status mysqld.service
systemctl enable mysqld.service
标签:systemd,target,service,创建,systemctl,mysqld,mysql
From: https://www.cnblogs.com/HJ-study/p/17387734.html