#重启服务器 init 6 #查看MySQL状态 [root@localhost ~]# systemctl status mysql ● mysqld.service - LSB: start and stop MySQL Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled) Active: active (running) since Wed 2021-05-26 18:20:26 CST; 9s ago Docs: man:systemd-sysv-generator(8) Process: 1592 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=0/SUCCESS) Tasks: 28 Memory: 225.5M CGroup: /system.slice/mysqld.service ├─1603 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql/date/3306 --pid... └─1771 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql/d...
May 26 18:20:23 localhost.localdomain systemd[1]: Starting LSB: start and stop MySQL... May 26 18:20:26 localhost.localdomain mysqld[1592]: Starting MySQL... SUCCESS! May 26 18:20:26 localhost.localdomain systemd[1]: Started LSB: start and stop MySQL.
5.关闭开机自启
1
systemctl disable mysql
6.验证
1 2 3 4 5 6 7 8 9 10 11 12
#重启服务器 init 6 #查看MySQL状态 [root@localhost ~]# systemctl status mysql ● mysql.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysql.service; disabled; vendor preset: disabled) Active: inactive (dead) Docs: man:mysqld http://dev.mysql.com/doc/refman/en/using-systemd.html [root@localhost ~]# systemctl enable mysql Created symlink from /etc/systemd/system/multi-user.target.wants/mysql.service to /usr/lib/systemd/ system/mysql.service.