mysql:sql_mode=‘STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_

问题一:1264 - Out of range value for column 'value' at row 1

问题二:[Err] 1292 - Incorrect datetime value: '0000-00-00 00:00:00' for column 'curtime' at row 1

问题三:MySQL [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause

 

问题一解决:对照字段,将字段的长度扩展;

问题二解决:修改/etc/mysql/my.conf中的:

修改sql_mode(将上述查询到的sql_mode中的NO_ZERO_DATE和NO_ZERO_IN_DATE删除即可)

获取:select @@sql_mode

我本地的是:

ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

示例:

sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

问题三解决:

解决办法就是吧 ONLY_FULL_GROUP_BYsql_mode中去掉

 

参考配置:

select @@global.sql_mode;

select version(),
@@sql_mode;SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));


# 修改全局
set @@global.sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
# 修改当前
set @@sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

 

你可能感兴趣的:(mysql,数据库)