在RHEL7中,使用systemctl 启动mysql
1,创建启动文件 .service
vi /usr/lib/systemd/system/mysqld.service
[Unit]
Description=MySQL Server
After=network.target
After=syslog.target
[Service]
User=mysql
Group=mysql
Type=forking
PermissionsStartOnly=true
ExecStart= /etc/init.d/mysqld start
ExecStop= /etc/init.d/mysqld stop
ExecReload= /etc/init.d/mysqld restart
LimitNOFILE = 5000
[Install]
WantedBy=multi-user.target
2,重新加载一下服务的配置文件
systemctl daemon-reload
3,开启mysql服务
systemctl start mysqld.service
4,关闭mysql服务
systemctl stop mysqld.service