MySQL 5.6.23升级到MySQL 5.7.9


MySQL 5.6.23升级到MySQL 5.7.9

MySQL 5.7.9新特性

一、安全性

1.1. 用户表 mysql.user 的 plugin字段不允许为空, 默认值是 mysql_native_password,而不是 mysql_old_password,不再支持旧密码格式;

1.2. 增加密码过期机制,过期后需要修改密码,否则可能会被禁用,或者进入沙箱模式;

1.3. 使用mysqld --initialize 初始化,默认会自动生成随机密码,并且不创建除 root@localhost 外的其他账号,也不创建 test 库;

改成 mysqld --initialize 后,如果 datadir 指向的目标目录下已经有数据文件,则会有类似提示:

2015-11-20T17:03:38.200709Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. 

2015-11-20T17:03:38.200807Z 0 [ERROR] Aborting

因此,需要先确保 datadir 目标目录下是空的,避免误操作破坏已有数据。

二.升级

2.1.解压tar -zxvf mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz

2.2.将5.7.9版本放到默认目录下面

mv mysql-5.7.9-linux-glibc2.5-x86_64 /usr/local/mysql

关闭mysql5.6.23数据库  service mysql stop

2.3.修改/etc/my.cnf 的数据路径,现有数据库mysql5.6.23已经跑业务 数据放在 /mnt/sda4/mysql5.6.23/data

datadir = /mnt/sda4/mysql5.6.23/data       

2.4.启动service mysql start

2.5.尝试插入并查看数据查看是否正常

[root@sam tt]# /usr/local/mysql/bin/mysql -uroot -h127.0.0.1 test -e "select * from  dsp_monitors where time='2015-11-19 14:03:00';"

+----+----------+----------+-----------+---------------------+--------------+---------------+---------------+----------+

| id | exchange | flowType | size      | time                | requestCount | filteredCount | outPriceCount | bidCount |

+----+----------+----------+-----------+---------------------+--------------+---------------+---------------+----------+

|  1 | tt    | desktop  | 250X250FC | 2015-11-19 14:03:00 |            0 |        431884 |            0 |        0 |

|  2 | tt    | desktop  | 250X250FC | 2015-11-19 14:03:00 |            0 |        431884 |            0 |        0 |

+----+----------+----------+-----------+---------------------+--------------+---------------+--

本文永久更新链接地址

相关内容