在CentOS 7下的Linux系统中安装MySQL
- 检查系统使用 Systemd 还是 SysVinit
ps -p 1 -o comm=
● 如果返回 systemd,则使用 Systemd(新版系统)。
● 如果返回 init,则使用 SysVinit(旧版系统)。
systemd 和 init 的区别是:systemd是CentOS7以上的命令,init 是CentOS6的命令
方式一:SysVinit(旧版系统)
查询目前已经开启的服务
第一步:目前已经开启的服务没有mysqld
chkconfig --list
第二步:增加mysql自动启动服务
chkconfig --add mysqld
第三步:查询是否添加成功,已经添加成功
chkconfig --list
第四步:开启mysqld启动服务
chkconfig mysqld on