mysql数据库报错:
Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'sm_invoiceApply.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
报错mysql版本号:5.7.42
相同的语句在mysql8.0以上版本没有问题;
解决方案:
修改配置文件my.cnf或者my.ini
linux服务器,全局查找my.cnf或my.ini所在目录
# find / -name my.cnf
在配置文件中加入:
[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
修改完成后一定要重启mysql
systemctl restart mysqld