■ 57版本原来配置
show variables like '%sql_mode%';
STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
■ 修改配置文件
注释掉sql_mode,并重启,查看57版本的默认设置
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
■ 修改全局变量
对新建的所有会话生效,但是对已经连接的会话无效set global sql_mode ='';
■ 修改会话变量
只对当前会话生效set sql_mode ='';
■ 修改配置文件
设置sql_mode='',重启后,则sql_mode为空了。
■ 以下测试
create database test;
grant CREATE, DROP, INSERT, SELECT, DELETE, UPDATE, ALTER on test.* to inspur@'%' identified by 'password';
set password for inspur@'%' = password('password');
drop user inspur@'%';
drop database test;
flush privileges;
set sql_mode ='NO_AUTO_CREATE_USER';
grant CREATE, DROP, INSERT, SELECT, DELETE, UPDATE, ALTER on test. to inspur@'%' identified by 'password';
set global sql_mode ='';
grant CREATE, DROP, INSERT, SELECT, DELETE, UPDATE, ALTER on test. to inspur@'%' identified by 'password';
均可以执行。
在80版本估计就有问题了。