MySQL error [this is incompatible with sql_mode = only_full_group_by]

Report error message:

Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘zsplus.ta.id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Reporting error

Mysql 5.7.5 and above function dependencies. If ONLY_FULL_GROUP_BY is enabled
SQL Mode (By default), MySQL will refuse to select a list, the Having condition, or the list of Query for the Order By list is referenced in Group.
The BY clause is not named nonset column, nor is it functionally dependent on them. (5.7.5 before, MySQL did not detect functional dependencies. ONLY_FULL_GROUP_BY is not enabled by default.)

Solution

1, check SQL_MODE

select @@global.sql_mode

The query is:

ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

2. Remove Only_Full_Group_by, reset the value.

# Change the global SQL_Mode, valid for the new database
set @@global.sql_mode 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';

3. For existing databases, you need to execute under the corresponding data.

set global sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';

The above way the database restart will be invalid, just modify the value in the memory, and cannot be permanently changed. Want to make permanent resolution to modify in the configuration file

4, configuration file modification

Windows under MySQL configuration file is My.ini, which is usually in the root directory of the installation directory.
LINUX's mysql configuration file is My.cnf, general location is /etc/my.cnf

# [MySQLD] Add below
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Restart mysql

Intelligent Recommendation

Mysql execute statement error this is incompatible with sql_mode=only_full_group_by

Error output: [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 depende...

Solve mysql report this is incompatible with sql_mode=only_full_group_by error

Baidu found most of the two solutions, generally recommend the following one, I use it and solve the problem. add the following line at the end of mysql my.ini file...

mysql error: this is incompatible with sql_mode=only_full_group_by solution

1. Problem description: Use mysql 5.7.21 to execute the following statement: select u.login_name loginName,u.user_name userName,s.student_user_id userId, s.student_code studentCode,tc.schedule_class_n...

MySQL- this is incompatible with sql_mode=only_full_group_by error solution

For record, my local computer mysql version is 8.0.19, which is almost a relatively new version. Query database version statement: select VERSION() The following error will appear when using the GROUP...

MySQL Error --This IS INCOMPATIBLE with SQL_MODE = ONLY_FULL_GROUP_BY Perfect Solution

Project scene: Sometimes, I encountered database duplicate data, you need to group data and take it out to show it, then you need to use the Group by statement. However, if mysql is a high version, wh...

More Recommendation

[Mysql use error] this is incompatible with sql_mode = only_full_group_by

Some errors encountered when using MySQL 1. Err1055, this problem occurs often when performing a SQL statement, there will be this problem in the last line. Solution: In the /etc/my.cnf (linux) file, ...

MySQL-this is incompatible with sql_mode = only_full_group_by error solution

Execute SQL reported this question: this is incompatible with sql_mode=only_full_group_by Reason for problems: The result of the output is called Target List, which is the field followed by SELECT, as...

Solve and analyze mysql error: this is incompatible with sql_mode = only_full_group_by

Solve and analyze mysql error: this is incompatible with sql_mode = only_full_group_by When developing a timing task, I forgot to change the configuration (think of it yourself), causing a waste of ti...

Mysql Query "this is incompatible with sql_mode = only_full_group_by" error

problem When deploying a server-deployed server, the original SQL statement has appeared "this is incompatible with sql_mode = only_full_group_by" error. reason After mysql5.7.5, the default...

MySQL appears This Is IncomPatible With SQL_Mode = only_Full_group_BY error solution

This is the error screenshot Cause: MySQL version problem MySQL 5.7.5 above versions have achieved detection of functional dependence. If you enable the only_full_group_by SQL mode (default), mysql wi...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top