#首先,将MySQL Yum存储库添加到系统的存储库列表中。#在https://dev.mysql.com/downloads/repo/yum/地址中,下载mysql yum repository[root@alone-mysql tools]# wget --no-check-certificate https://dev.mysql.com/get/mysql80-community-release-el6-3.noarch.rpm
[root@alone-mysql tools]# rpm -Uvh mysql80-community-release-el6-3.noarch.rpm warning: mysql80-community-release-el6-3.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ########################################### [100%] 1:mysql80-community-relea########################################### [100%]
#查看已经生效的mysql yum repository中哪些repository是启用哪些是禁用,默认是启用当前最新的mysql8[root@alone-mysql tools]# yum repolist enabled | grep mysql mysql-connectors-community MySQL Connectors Community 94mysql-tools-community MySQL Tools Community 78mysql55-community MySQL 5.5 Community Server 99
#这里我们需要禁用默认的mysql8,而启用mysql5.5[root@alone-mysql tools]# yum-config-manager --disable mysql80-community[root@alone-mysql tools]# yum-config-manager --enable mysql55-community#再查看已经生效的mysql yum repository[root@alone-mysql tools]# yum repolist enabled | grep mysql mysql-connectors-community MySQL Connectors Community 94mysql-tools-community MySQL Tools Community 78mysql55-community MySQL 5.5 Community Server 487#也可以手工对mysql-community.repo文件进行编辑,将mysql 5.5的enabled设置为1,将mysql8.0的enabled设置为0[root@alone-mysql tools]# ls -l /etc/yum.repos.d/mysql-community.repo -rw-r--r--. 1 root root 2074 May 26 22:15 /etc/yum.repos.d/mysql-community.repo
#然后使用yum安装mysql[root@alone-mysql tools]# yum install -y mysql-community-server#启动mysql,在启动mysql的时候留意一下提示信息[root@alone-mysql tools]# service mysqld start
#这里按照上面的提示设置一下mysql的密码[root@alone-mysql tools]# /usr/bin/mysqladmin -u root password 'root'#现在可以使用新密码登录我们的mysql[root@alone-mysql tools]# mysql -uroot -pEnter password:
详细内容查看:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/