下载mysql的yum包 点击打开链接下载
下载完成后
安装不
rmp -ivh mysql57-community-release-el7-11.noarch.rpm
vi /etc/yum.repos.d/mysql-community.repo 将MySQL 5.6 enabled=1,MySQL 5.7 enabled=0 [mysql56-community] name=MySQL 5.6 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql [mysql57-community] name=MySQL 5.7 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
yum repolist all | grep mysql
接下来设置yum,直接安装是mysql5.7的,设置为5.6
yum repolist all | grep mysql 出现如下信息代表可以安装mysql了 mysql-cluster-7.5-community/x86_64 MySQL Cluster 7.5 Community 禁用 mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - So 禁用 mysql-cluster-7.6-community/x86_64 MySQL Cluster 7.6 Community 禁用 mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community - So 禁用 !mysql-connectors-community/x86_64 MySQL Connectors Community 启用: 36 mysql-connectors-community-source MySQL Connectors Community - Sou 禁用 !mysql-tools-community/x86_64 MySQL Tools Community 启用: 47 mysql-tools-community-source MySQL Tools Community - Source 禁用 mysql-tools-preview/x86_64 MySQL Tools Preview 禁用 mysql-tools-preview-source MySQL Tools Preview - Source 禁用 mysql55-community/x86_64 MySQL 5.5 Community Server 禁用 mysql55-community-source MySQL 5.5 Community Server - Sou 禁用 !mysql56-community/x86_64 MySQL 5.6 Community Server 启用: 327 mysql56-community-source MySQL 5.6 Community Server - Sou 禁用 !mysql57-community/x86_64 MySQL 5.7 Community Server 禁用 mysql57-community-source MySQL 5.7 Community Server - Sou 禁用 mysql80-community/x86_64 MySQL 8.0 Community Server 禁用 mysql80-community-source MySQL 8.0 Community Server - Sou 禁用
yum repolist all | grep mysql 出现如下信息代表可以安装mysql了 mysql-cluster-7.5-community/x86_64 MySQL Cluster 7.5 Community 禁用 mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - So 禁用 mysql-cluster-7.6-community/x86_64 MySQL Cluster 7.6 Community 禁用 mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community - So 禁用 !mysql-connectors-community/x86_64 MySQL Connectors Community 启用: 36 mysql-connectors-community-source MySQL Connectors Community - Sou 禁用 !mysql-tools-community/x86_64 MySQL Tools Community 启用: 47 mysql-tools-community-source MySQL Tools Community - Source 禁用 mysql-tools-preview/x86_64 MySQL Tools Preview 禁用 mysql-tools-preview-source MySQL Tools Preview - Source 禁用 mysql55-community/x86_64 MySQL 5.5 Community Server 禁用 mysql55-community-source MySQL 5.5 Community Server - Sou 禁用 !mysql56-community/x86_64 MySQL 5.6 Community Server 启用: 327 mysql56-community-source MySQL 5.6 Community Server - Sou 禁用 !mysql57-community/x86_64 MySQL 5.7 Community Server 禁用 mysql57-community-source MySQL 5.7 Community Server - Sou 禁用 mysql80-community/x86_64 MySQL 8.0 Community Server 禁用 mysql80-community-source MySQL 8.0 Community Server - Sou 禁用
安装
安装 yum install mysql-community-server 启动mysql systemctl start mysqld 设置mysql初始密码 mysql_secure_installation如果密码修改不了可以参考我的MySQL修改密码文章