我有一个在MySQL 5.6上运行良好的存储过程。在最近的服务器迁移期间,我们升级到了MySQL 5.7.19。存储过程引发“与sql_mode = only_full_group_by不兼容”尽管sql_mode为空
我的存储过程,现在抛出的错误:
Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'utility-monitor.daily_readings.building_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by: CALL monthly_readings(2017, 1, NULL, 1, 1))
我已经设置了通过sql_mode
到""
的/var/mysql/my.cnf
文件,重新启动mysql服务,并通过控制台登录,确认sql_mode
通过为空白SELECT @@sql_mode;
尽管如此,我仍然在尝试运行存储过程时继续收到上述错误。
接下来可以做些什么来继续排除此错误来自何处?
“ONLY_FULL_GROUP_BY”是MySQL 5.7中的默认值。 – Barmar
https://stackoverflow.com/questions/23921117/disable-only-full-group-by检查此 – Jenish