Error related to only_full_group_by when executing a query in MySql

前端 未结 18 2554
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-21 04:39

I have upgraded my system and have installed MySql 5.7.9 with php for a web application I am working on. I have a query that is dynamically created, and when run in older ve

18条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-11-21 04:56

    The consensus answer above is good but if you've got problems running queries within stored procedures after fixing your my.cnf file, then try loading your SPs again.

    I suspect MySQL must have compiled the SPs with the default only_full_group_by set originally. Therefore, even when I changed my.cnf and restarted mysqld it had no effect on the SPs, and they kept failing with "SELECT list is not in GROUP BY clause and contains nonaggregated column ... which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by".

    Reloading the SPs must have caused them to be recompiled now with only_full_group_by disabled. After that, they seem to work as expected.

提交回复
热议问题