mysql sql

xiaoxiao2025-06-16  10

linux服务器上的mysql 运行一切正常

在本地mysql 的时候报错

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: In aggregated query without GROUP BY, expression #9 of SELECT list contains nonaggregated column 'yd_2.al.level'; this is incompatible with sql_mode=only_full_group_by

重点是这句this is incompatible with sql_mode=only_full_group_by

翻译过来大概是在  sql_mode=only_full_group_by 下是不相容的

于是想办法修改 sql_mode ,

我先看了下自己的mysql版本

是5.7

然后查看当前sql_mode 

修改my.cnf(windows下是my.ini)配置文件

sql_mode=STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

重启mysql服务  就可以了  

在积累以上经验之前还试过很多用sql 语句修改sql_model的   没有成功,至少在我5.7上没有成功!

转载请注明原文地址: https://www.6miu.com/read-5031952.html

最新回复(0)