91名师指路-头部
91名师指路

Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column '

由于某些原因,现在不支持支付宝支付,如需要购买源码请加博主微信进行购买,微信号:13248254750

mysql 报错如下:

### Cause: java.sql.SQLSyntaxErrorException: Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'mszl_new.m.menu_sort' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

解决方法:

1)我们先用navicat连接工具执行命令。查看sql_mode

select version(), @@sql_mode;



2)我们更改mysql的配置文件/etc/my.cnf.d/mysql-server.cnf(我是mysql 8.0),如果是mysql5.x,文件路径是/etc/my.cnf(其实就是将ONLY_FULL_GROUP_BY去掉)

我们在mysql-server.cnf文件的末尾添加

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


3)重启mysql即可

service mysqld restart


2021-01-02 09:18:58     阅读(1870)

名师出品,必属精品    https://www.91mszl.com

联系博主    
用户登录遮罩层
x

账号登录

91名师指路-底部