将现有版本的mysql 5.6.35更新为5.7.17

时间:2017-02-08 15:22:20

标签: mysql

我在kali linux上安装了mysql 5.6.35。如何将其更新为5.7.17?

我尝试过mysql_upgrade会出现以下错误

Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Error: Failed while fetching Server version! Could be due to unauthorized access.
FATAL ERROR: Upgrade failed

1 个答案:

答案 0 :(得分:1)

您必须传递root密码:

mysql_upgrade -u root -p

然而,这还不足以升级到5.7.x

首先从https://repo.mysql.com/下载并安装mysql社区发布回购:

cd ~
wget http://repo.mysql.com/mysql-community-release-el7-7.noarch.rpm
rpm -ivh mysql*.rpm
rpm -qa | grep mysql | grep release
mysql-community-release-el7-7.noarch

根据您之前从https://repo.mysql.com/下载的内容,您可能需要按照本指南的说明启用subrepo: https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html

基本上你需要禁用旧的subrepo并启用dev one:

yum-config-manager --disable mysql56-community
yum-config-manager --enable mysql57-community-dmr

您可以检查子目录的状态:

yum repolist all | grep mysql5..c

最终升级mysql:

yum clean all
yum upgrade
yum autoremove
mysql_upgrade -u root -p

验证已安装的版本:

rpm -qa | grep mysql | grep server
mysql-community-server-5.7.17-1.el7.x86_64

额外: 您始终可以检查.rpm内容,例如:

 rpm2cpio ~/mysql-community-release-el7-7.noarch.rpm | cpio -idmv
 cd ~/etc/yum.repos.d
 cat mysql-community.repo

通过这种方式,您可以看到添加了哪个子目录。