1.rpm -Uvh http:
//dev
.mysql.com
/get/mysql-community-release-el6-5
.noarch.rpm #下载
2.yum
install
yum-utils -y #装源
3.
yum-config-manager --disable mysql56-community # 禁用MySQL5.6的源
4.yum-config-manager --
enable
mysql57-community-dmr
# 启用MySQL5.7的源
5.yum repolist enabled |
grep
mysql
6.yum
install
mysql-community-server #安装mysql
到这里时有些会报一下错
错误显示:
软件包:mysql-community-server-5.7.20-1.el6.x86_64 (mysql57-community)
需要:libsasl2.so.2()(64bit)
您可以尝试添加 --skip-broken 选项来解决该问题
您可以尝试执行:rpm -Va --nofiles --nodigest
解决方法:
修改vim /etc/yum.repos.d/mysql-community.repo 源文件
[mysql57-community]
name=MySQL 5.7 Community Server
## baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
7.yum
install
mysql-community-server #再次安装mysql
8.systemctl start mysqld #启动mysql
9.systemctl status mysqld #查看mysql启动状态