指令 | 作用 |
systemctl start 服务名 | 开启服务 |
systemctl stop 服务名 | 关闭服务 |
systemctl status 服务名 | 显示状态 |
systemctl restart 服务名 | 重启服务 |
systemctl enable 服务名 | 开机启动服务 |
systemctl disable 服务名 | 禁止开机启动 |
systemctl list-units | 查看系统中所有正在运行的服务 |
systemctl list-unit-files | 查看系统中所有服务的开机启动状态 |
systemctl list-dependencies 服务名 | 查看系统中服务的依赖关系 |
systemctl mask 服务名 | 冻结服务 |
systemctl unmask 服务名 | 解冻服务 |
systemctl set-default multi-user.target | 开机时不启动图形界面 |
systemctl set-default graphical.target | 开机时启动图形界面 |
启动服务命令service mysql start,查看服务命令service mysql status。
有时候用service才能起动服务,systemctl启动不了。