由于之前的机器安装了mysql5.6,现在想升级到mysql5.7。
一、卸载mysql-5.6
初级思路:
1、卸载mysql5.6
2、升级到mysql5.7
初级思路遇到的问题:
1、卸载mysql 5.7后,使用Google的方式,安装mysql57-community-release-el7-7.noarch.rpm时遇到了问题,原因是:
Error: mysql57-community-release conflicts with mysql-community-release-el7-5.noarch You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
然后使用以下命令安装:
# rpm -i mysql57-community-release-el7-7.noarch.rpm error: Failed dependencies: mysql-community-release conflicts with mysql57-community-release-el7-7.noarch
结果也不行!
然后我尝试卸载冲突项,系统提示冲突项不存在!!
解决方法:使用rpm -qa 查找已安装包
[root@localhost ~]# rpm -qa | grep mysql mysql-community-release-el7-5.noarch mysql-community-common-5.6.35-2.el7.x86_64 mysql-community-libs-5.6.35-2.el7.x86_64
然后依次卸载:
[root@localhost ~]# rpm -e --nodeps mysql-community-release-el7-5.noarch [root@localhost ~]# rpm -e --nodeps mysql-community-common-5.6.35-2.el7.x86_64 [root@localhost ~]# rpm -e --nodeps mysql-community-libs-5.6.35-2.el7.x86_64
yum remove mysql-server
二、安装Mysql5.7
1、下载源
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
2、安装源
yum localinstall mysql57-community-release-el7-7.noarch.rpm
3、确认并安装
# yum install mysql-server
版本确认:
Dependencies Resolved =========================================================================================================================== Package Arch Version Repository Size =========================================================================================================================== Installing: mysql-community-server x86_64 5.7.17-1.el7 mysql57-community 162 M Installing for dependencies: mysql-community-client x86_64 5.7.17-1.el7 mysql57-community 24 M mysql-community-common x86_64 5.7.17-1.el7 mysql57-community 271 k mysql-community-libs x86_64 5.7.17-1.el7 mysql57-community 2.1 M net-tools x86_64 2.0-0.17.20131004git.el7 base 304 k Transaction Summary =========================================================================================================================== Install 1 Package (+4 Dependent packages)
四、确认版本
[root@localhost ~]# mysql --version mysql Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using EditLine wrapper
三、改变root密码
0、启动mysqld
systemctl start mysqld
1、查看临时密码:
[root@localhost ~]# grep 'temporary password' /var/log/mysqld.log 2017-03-14T01:46:42.491508Z 1 [Note] A temporary password is generated for root@localhost: Moik&g!cp5ue
2、修改密码
# mysql_secure_installation
3、允许所有外网访问
1、启动mysql
systemctl restart mysqld
2、登录mysql
mysql -u root -p mysql>use mysql;
3、允许所有主机访问
mysql> update user set host='%' where user='root'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0
-
参考链接
http://www.tecmint.com/install-latest-mysql-on-rhel-centos-and-fedora/
http://www.cnblogs.com/suredandan/p/3953299.html
https://dev.mysql.com/doc/refman/5.7/en/problems-connecting.html