[Solved] MYSQL8 group by Error: Cause: java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY

Reason: myql8 enable only_FULL_GROUP_BY

1. Select @global.sql_mode   A value indicates that group by mode is enabled

2. Turn off this mode:

Add a line of instructions under [mysqld] in my.cnf configuration file

[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_ BY_ZERO,NO_ENGINE_SUBSTITUTION

3. Restart MySQL service

Similar Posts: