加入收藏 | 设为首页 | 会员中心 | 我要投稿 PHP编程网 - 黄冈站长网 (http://www.0713zz.com/)- 数据应用、建站、人体识别、智能机器人、语音技术!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

mysql5.6怎么提升到mysql5.7

发布时间:2021-12-19 20:29:21 所属栏目:MySql教程 来源:互联网
导读:mysql5.6怎么升级到mysql5.7,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。 1、停止mysql5.6数据库服务 [root@host2 mysql]# /etc/init.d/mysqld stop Shutting down MySQL.. [ OK ] [r
mysql5.6怎么升级到mysql5.7,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
 
1、停止mysql5.6数据库服务
 
[root@host2 mysql]# /etc/init.d/mysqld stop
Shutting down MySQL..                                      [  OK  ]
[root@host2 mysql]#
 
2、进入/usr/local更换软连接指定到mysql5.7
 
[root@host2 local]# ls
bin  games    lib    libexec  mysql                               mysql-5.7.16-linux-glibc2.5-x86_64  mysql-utilities-1.6.5.tar.gz  share
etc  include  lib64  my.cnf   mysql-5.6.34-linux-glibc2.5-x86_64  mysql-utilities-1.6.5               sbin                          src
[root@host2 local]# unlink mysql
  
3、启动数据库并进入数据库
 
[root@host2 local]# /etc/init.d/mysqld start
Starting MySQL.............................................[  OK  ]..............................
[root@host2 local]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.7.16-log MySQL Community Server (GPL)
 
 
(可以看到数据库已经到5.7版本了)
 
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql>
 
4、更新数据结构(生产环境使用mysql_upgrade更新的时候加-s参数  不重建表)
 
[root@host2 local]# mysql_upgrade -p123 -s
mysql_upgrade: [Warning] Using a password on the command line interface can be insecure.
The --upgrade-system-tables option was used, databases won't be touched.
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Upgrading the sys schema.
Upgrade process completed successfully.
Checking if update is needed.
 
至此升级成功
5、进入数据库查看
 
 
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test               |
+--------------------+
可以看到sys库已经存在,但是直接安装的5.7的库是没有test库的,这里sys和test同时存在说明是从5.6升级到5.7
看完上述内容,你们掌握mysql5.6怎么升级到mysql5.7的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

(编辑:PHP编程网 - 黄冈站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读