【发布时间】:2018-01-15 13:44:36
【问题描述】:
我有一个在 MySQL 5.6 上运行良好的存储过程。在最近的一次服务器迁移中,我们升级到了 MySQL 5.7.19。
我的存储过程现在抛出错误:
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))
我已经通过/var/mysql/my.cnf文件将sql_mode设置为"",重启mysql服务并通过控制台登录以确认sql_mode通过SELECT @@sql_mode;为空
尽管如此,当我尝试运行我的存储过程时,我仍然收到上述错误。
接下来我该怎么做才能继续排查此错误的来源?
【问题讨论】:
-
ONLY_FULL_GROUP_BY是 MySQL 5.7 中的默认值。