systemd管理服务器

systemctl list-units --all --type=service #查看所有系统服务
systemctl disable mysqld 让服务开机不自启
systemctl enable mysqld 让服务开机启动
systemdctl disable mysqld 查看服务状态
systemdctl stop mysqld 停止服务
systemdctl start mysqld 启动服务
systemdctl restart mysqld 重启服务
systemctl is-enabled mysqld 检查服务是否开机启动

  • systemctl list-units --all --type=service
    查看所有系统服务
[root@nianhua ~]# systemctl list-units --all --type=service
  • systemctl disable mysqld
    不让mysqld开启启动
[root@nianhua ~]# systemctl disable mysqld 
mysqld.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mysqld off
  • systemctl enable mysqld
    让mysqld服务开机启动
[root@nianhua ~]# systemctl enable mysqld
mysqld.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mysqld on
  • systemctl enable mysqld
    查看mysqld服务状态
[root@nianhua ~]# systemctl disable mysqld
mysqld.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mysqld off
[root@nianhua ~]# systemctl enable mysqld
mysqld.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mysqld on
[root@nianhua ~]# systemctl status mysqld
● mysqld.service - LSB: start and stop MySQL
   Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
   Active: active (running) since 二 2018-11-20 22:34:25 CST; 2h 37min ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/mysqld.service
           ├─1137 /bin/sh /www/server/mysql/bin/mysqld_safe --datadir=/www/server/data --pid-file=/www/se...
           └─2176 /www/server/mysql/bin/mysqld --basedir=/www/server/mysql --datadir=/www/server/data --p...

11月 20 22:34:21 nianhua systemd[1]: Starting LSB: start and stop MySQL...
11月 20 22:34:25 nianhua mysqld[1107]: Starting MySQL.... SUCCESS!
11月 20 22:34:25 nianhua systemd[1]: Started LSB: start and stop MySQL.
  • systemctl stop mysqld
    停止mysql服务
[root@nianhua ~]# systemctl stop mysqld
  • systemcel start mysqld
    启动mysqld服务器
[root@nianhua ~]# systemctl start mysqld
  • systemctl restart mysqld
    重启mysqld服务
[root@nianhua ~]# systemctl restart mysqld
  • systemctl is-enabled mysqld
    查看mysqld服务状态
[root@nianhua ~]# systemctl is-enabled mysqld
mysqld.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mysqld --level=5
enabled

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值