CentOS 6 与 CentOS 7 启停服务

CentOS 6

1
2
3
4
5
6
7
8
# 设置服务自启动
chkconfig --add mysqld # 添加服务
chkconfig mysqld on # 开机自启服务
chkconfig mysqld off # 关闭开机自启
chkconfig --list | grep mysqld # 查看

# 查看状态、启动、停止、重启
service mysqld status/start/stop/restart

CentOS 7

1
2
3
4
5
systemctl enable mysqld.service  # 开机自启服务
systemctl disable mysqld.service # 关闭开机自启

# 查看状态、启动、停止、重启
systemctl status/start/stop/restart mysqld.service