SoFunction
Updated on 2025-03-10

Solve the problem of group by error reporting under laravel5.4

Using ORM to query data shows this error, because laravel uses strict mode of MySQL enabled. So if you want to close it, we need to find the config/ file and then turn it off.

Change this in mysql to false; it will be closed.

Since it is said that the strict mode is, what is the mode? As far as I know, there is a urine urinary function in mysql in 5.7

[Error: only_full_group_by], the data of your group by must contain the data you query, which means that if your sql is: select name,age from user group by name; this may be fine below 5.7, but when you find an error showing a group by error, you have to change it to select name,age from user group by name,age; to execute, but this is separated from our original query. So what we can choose is to turn it off.

Find it, edit it ~ put the following command in the appropriate position and restart mysql

sql_model = STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,

The above article solves the problem of group by error under laravel5.4. This is all the content I share with you. I hope you can give you a reference and I hope you can support me more.