Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and co

MySQL5.7 Group BY statement error:
Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘t.road_name’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
The reason I looked for it was because in versions prior to MySQL5.7,
MySQL does not detect functional dependencies,
The only_FULL_group_BY default is not enabled.
Only_full_group_by default is enabled in MYSQL5.7.
So MySQL will reject queries that reference a list, condition, or order,
These queries refer to unnamed non-aggregated columns in a group rather than relying on them functionally.
Solutions:
Find the MySQL configuration file
Find /etc/my.cnf on the server and edit it

Add a sentence to the document:
sql_mode=’STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION’

Then restart MySQL. LNMP is installed here. Just enter LNMP restart

Read More: