Mysql: MySQL-this is incompatible with sql_mode=only_full_group_by error resolution

tags: mysql  centos

First, the background

Previously used local server in development, local is mysql5.6, there is a problem when switching to online server

Prompt MySQL-this is incompatible with sql_mode=only_full_group_by

After the query, the mysql version on the server is mysql5.7.

Second, the problem description

I found the reason after I searched online.

First, the principle level

 This error occurs in mysql version 5.7 and above issues:

 The default sql configuration for mysql version 5.7 is: sql_mode="ONLY_FULL_GROUP_BY", this configuration strictly enforces the "SQL92 standard".

 Many upgrades from 5.6 to 5.7, in order to be grammatically compatible, most will choose to adjust sql_mode to keep it consistent with 5.6, in order to be as compatible as possible.

   Second, the sql level

 This reason occurs when sql is executed:

 To put it simply: the result of the output is called target list, which is the field followed by select, and there is a place group by column, which is

 The group followed by the field. Since the setting of ONLY_FULL_GROUP_BY is turned on, if a field is not in the target list

 And the group by field appears at the same time, or the value of the aggregate function, then this sql query is considered illegal by mysql, will report an error.

Third, the solution

Need to modify the mysql configuration file, by manually adding sql_mode to force the specified ONLY_FULL_GROUP_BY attribute is not required

[root@darg90 /]# vi /etc/my.cnf
 
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

[root@darg90 /]# service mysqld restart
Stop mysqld: [OK]
 Starting mysqld: [OK]
[root@darg90 /]# 

Restart the mysql server to test again, the problem is solved!

 

Reference article

Intelligent Recommendation

MySQL-this is incompatible with sql_mode=only_full_group_by error solution

MAMP MySql configuration file path under Mac /Applications/MAMP/tmp/mysql/my.cnf First, the principle level You need to modify the mysql configuration file to force the specified ONLY_FULL_GROUP_BY at...

Resolved: mysql error: 1055 - this is incompatible with sql_mode = only_full_group_by

mysql query error: [Err] 1055 - Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'tase1.ai.home_url' which is not functionally dependent on columns in GROUP BY ...

MySQL error [Err] 1055 ... this is incompatible with sql_mode = only_full_group_by

Problem Description After upgrading MySQL version is 8.0.12, there is a problem. When you create a data table, or perform updates, error [Err] 1055 ... The following error message: [Err] 1055 - Expres...

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...

More Recommendation

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...

[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, ...

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

Top