mysql5.6升5.7_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

创建新的链接

[root@host2 local]# ln -s mysql-5.7.16-linux-glibc2.5-x86_64 mysql

[root@host2 local]# ll

total 712

drwxr-xr-x.  2 root  root    4096 Jun 28  2011 bin

drwxr-xr-x.  2 root  root    4096 Jun 28  2011 etc

drwxr-xr-x.  2 root  root    4096 Jun 28  2011 games

drwxr-xr-x.  2 root  root    4096 Jun 28  2011 include

drwxr-xr-x.  2 root  root    4096 Jun 28  2011 lib

drwxr-xr-x.  2 root  root    4096 Jun 28  2011 lib64

drwxr-xr-x.  2 root  root    4096 Jun 28  2011 libexec

-rw-r--r--.  1 root  root    2754 Nov  6 15:44 my.cnf

lrwxrwxrwx.  1 root  root      34 Mar  8 15:34 mysql -> mysql-5.7.16-linux-glibc2.5-x86_64

drwxr-xr-x. 12 mysql mysql   4096 Feb 27 18:33 mysql-5.6.34-linux-glibc2.5-x86_64

drwxr-xr-x. 11 root  mysql   4096 Nov 19 00:01 mysql-5.7.16-linux-glibc2.5-x86_64

drwxr-xr-x.  7  7161 31415   4096 Feb 28 02:00 mysql-utilities-1.6.5

-rw-r--r--.  1 root  root  668241 Feb 28 01:59 mysql-utilities-1.6.5.tar.gz

drwxr-xr-x.  2 root  root    4096 Jun 28  2011 sbin

drwxr-xr-x.  5 root  root    4096 Nov  6 22:15 share

drwxr-xr-x.  2 root  root    4096 Jun 28  2011 src

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值