RPM方式安装
- 卸载MariaDB库
[root@localhost ~]# yum remove mariadb-libs -y
- 安装Perl模块
[root@localhost ~]# yum install perl-Module-Install -y
- 下载MySQL的安装包
下载链接为
http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-common-5.6.47-2.el7.x86_64.rpm
http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-libs-5.6.47-2.el7.x86_64.rpm
http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-client-5.6.47-2.el7.x86_64.rpm
http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-server-5.6.47-2.el7.x86_64.rpm
可以在Windows系统下载好再导入CentOS - rpm命令安装MySQL客户端和服务器
按以下顺序安装
[root@localhost ~]# rpm -ivh mysql-community-common-5.6.47-2.el7.x86_64.rpm
[root@localhost ~]# rpm -ivh mysql-community-libs-5.6.47-2.el7.x86_64.rpm
[root@localhost ~]# rpm -ivh mysql-community-client-5.6.47-2.el7.x86_64.rpm
[root@localhost ~]# rpm -ivh mysql-community-server-5.6.47-2.el7.x86_64.rpm
- 启动和设置开机启动MySQL Server
[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# systemctl enable mysqld
- 查询MySQL Server的状态,正常是active (running)状态
[root@localhost ~]# systemctl status mysqld
YUM方式安装
上述步骤2,3,4替换为下面两步
- rpm命令安装MySQL的repo源
[root@localhost ~]# rpm -ivh http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-release-el7-5.noarch.rpm
- yum命令安装
[root@localhost ~]# yum install mysql-community-server -y