在CentOS设置MariaDB的开机自启动

时间:2020-12-17 15:42:55

在CentOS设置MariaDB的开机自启动

作者:chszs,转载需注明。博客主页:http://blog.csdn.net/chszs

1、检查MySQL是否在可管理列表中

[root@Cloud-Q2 ~]# chkconfig --list

abrt-ccpp      0:off1:off2:off3:on4:off5:on6:off
abrtd          0:off1:off2:off3:on4:off5:on6:off
acpid          0:off1:off2:on3:on4:on5:on6:off
atd            0:off1:off2:off3:on4:on5:on6:off
auditd         0:off1:off2:on3:on4:on5:on6:off
autofs         0:off1:off2:off3:on4:on5:on6:off
blk-availability0:off1:on2:on3:on4:on5:on6:off
certmonger     0:off1:off2:off3:on4:on5:on6:off
cgconfig       0:off1:off2:off3:off4:off5:off6:off
cgred          0:off1:off2:off3:off4:off5:off6:off
cpuspeed       0:off1:on2:on3:on4:on5:on6:off
crond          0:off1:off2:on3:on4:on5:on6:off
cups           0:off1:off2:on3:on4:on5:on6:off
haldaemon      0:off1:off2:off3:on4:on5:on6:off
ip6tables      0:off1:off2:on3:on4:on5:on6:off
iptables       0:off1:off2:on3:on4:on5:on6:off
irqbalance     0:off1:off2:off3:on4:on5:on6:off
kdump          0:off1:off2:off3:on4:on5:on6:off
lvm2-monitor   0:off1:on2:on3:on4:on5:on6:off
mcelogd        0:off1:off2:off3:on4:off5:on6:off
mdmonitor      0:off1:off2:on3:on4:on5:on6:off
messagebus     0:off1:off2:on3:on4:on5:on6:off
mysqld         0:off1:off2:off3:off4:off5:off6:off
netconsole     0:off1:off2:off3:off4:off5:off6:off
netfs          0:off1:off2:off3:on4:on5:on6:off
network        0:off1:off2:on3:on4:on5:on6:off
nfs            0:off1:off2:off3:off4:off5:off6:off
nfslock        0:off1:off2:off3:on4:on5:on6:off
ntpd           0:off1:off2:off3:off4:off5:off6:off
ntpdate        0:off1:off2:off3:off4:off5:off6:off
numad          0:off1:off2:off3:off4:off5:off6:off
oddjobd        0:off1:off2:off3:off4:off5:off6:off
portreserve    0:off1:off2:on3:on4:on5:on6:off
postfix        0:off1:off2:on3:on4:on5:on6:off
postgresql     0:off1:off2:off3:off4:off5:off6:off
psacct         0:off1:off2:off3:off4:off5:off6:off
quota_nld      0:off1:off2:off3:off4:off5:off6:off
rdisc          0:off1:off2:off3:off4:off5:off6:off
restorecond    0:off1:off2:off3:off4:off5:off6:off
rngd           0:off1:off2:off3:off4:off5:off6:off
rpcbind        0:off1:off2:on3:on4:on5:on6:off
rpcgssd        0:off1:off2:off3:on4:on5:on6:off
rpcsvcgssd     0:off1:off2:off3:off4:off5:off6:off
rsyslog        0:off1:off2:on3:on4:on5:on6:off
saslauthd      0:off1:off2:off3:off4:off5:off6:off
smartd         0:off1:off2:off3:off4:off5:off6:off
sshd           0:off1:off2:on3:on4:on5:on6:off
sssd           0:off1:off2:off3:off4:off5:off6:off
sysstat        0:off1:on2:on3:on4:on5:on6:off
udev-post      0:off1:on2:on3:on4:on5:on6:off
winbind        0:off1:off2:off3:off4:off5:off6:off
ypbind         0:off1:off2:off3:off4:off5:off6:off

2、如果mysqld没有在列表,那么用命令添加它:

# chkconfig add mysqld
我们可以看到,mysqld本来就在列表中,所以这一步我们跳过。

3、使用命令设置开机启动:

# chkconfig add mysqld

我们再次检查列表,发现结果是这样的:
......
mysqld         0:off1:off2:on3:on4:on5:on6:off
......

表示MariaDB的开机自动启动已经设置完成。