今早,把开发环境的mysql升级到了5.7.15,5.6数据导入后,启动一切正常,检查.err日志,发现有如下异常:
2016-10-31T00:29:33.187073Z 0 [Warning] System table ‘time_zone_leap_second‘ is expected to be transactional.
2016-10-31T00:29:33.187093Z 0 [Warning] System table ‘time_zone_name‘ is expected to be transactional.
2016-10-31T00:29:33.187097Z 0 [Warning] System table ‘time_zone‘ is expected to be transactional.
2016-10-31T00:29:33.187101Z 0 [Warning] System table ‘time_zone_transition_type‘ is expected to be transactional.
2016-10-31T00:29:33.187104Z 0 [Warning] System table ‘time_zone_transition‘ is expected to be transactional.
2016-10-31T00:29:33.187690Z 0 [Warning] System table ‘servers‘ is expected to be transactional.
2016-10-31T00:29:33.188536Z 0 [Warning] Info table is not ready to be used. Table ‘mysql.slave_master_info‘ cannot be opened.
2016-10-31T00:29:33.188827Z 0 [Warning] Info table is not ready to be used. Table ‘mysql.slave_relay_log_info‘ cannot be opened.
2016-10-31T00:29:33.195026Z 0 [ERROR] Incorrect definition of table mysql.db: expected column ‘User‘ at position 2 to have type char(32), found type char(16).
2016-10-31T00:29:33.195055Z 0 [ERROR] mysql.user has no `Event_priv` column at position 28
2016-10-31T00:29:33.195236Z 0 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
执行mysql_update进行升级即可。
相关5.7不兼容的mysql参数包括如下:
max_statement_time=300000
innodb_log_block_size=4096
还有一个问题是,通过service mysql start启动后,service mysql stop无法删除${hostname}.pid文件,看support-files提供的mysql.server文件又是有rm *.pid命令的,事后得再看下哪里的问题。
另外,其他一些常用变化如下:
1、在mysql 5.6中,开始innodb监控的方法(这在mysqld hang,mysql客户端本身就无法登录进去的时候是很有用的)如下:
use mysql;
CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
在mysql 5.7下,调整为如下:
set GLOBAL innodb_status_output=ON;
2、正规的创建用户、修改密码方式调整为接近oracle的语法:
5.6:
grant all on *.* to [email protected]‘172.18.%‘ identified by "password";
set password for [email protected]‘172.18.%‘=password(‘password‘);
5.7:
create user [email protected]‘172.18.%‘ identified by ‘[email protected]#‘;
alter user [email protected]‘172.18.%‘ identified by ‘[email protected]#‘; --用户必须已经存在