解决[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated

1. Problem description

An unexpected error was reported when using MySQL query:

[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Two, the solution

1. In the Windows environment, there is a my.ini file in the MySQL installation path, and the following content is added in it:
( 一定要在[mysqld] 下面添加)

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

/etc/my.cnf2. Add the following content under [mysqld] of the configuration file in the virtual machine environment :

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

Then enter MySQL in the bin directory service mysqld restartto restart MySQL

Guess you like

Origin blog.csdn.net/weixin_43520450/article/details/129559107