MySQL-this is incompatible with sql_mode=only_full_group_by

tags: Pitfalls encountered in the learning process  Record SQL statements encountered during work and study

Today, I wrote a multi-table query using MySQL 5.5 locally, and the result was reported on the server MySQL-this is incompatible with sql_mode=only_full_group_by
It was later discovered that it was the 5.7 version of MySQL used by the server

The default sql configuration of mysql 5.7 version is: sql_mode="ONLY_FULL_GROUP_BY", this configuration strictly implements the "SQL92 standard". Since the ONLY_FULL_GROUP_BY setting is turned on, if a field does not appear in the target list and group by fields at the same time, or is the value of an aggregate function, then this SQL query is considered illegal by mysql and an error will be reported.

Of course the solution is very simple. You can use the following statement to query your sql_mode
SELECT @@GLOBAL.sql_mode;

The mysql configuration file needs to be modified, and the ONLY_FULL_GROUP_BY attribute is not required by manually adding sql_mode.
MySQL configuration file my.cnf is located in the etc folder,

vi  /etc/my.cnf

Move the cursor under vim to the position shown in the figure below, add the following code and save and exit: wq and then restart MySQL

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

Attachment: CentOS7 commonly used MySQL commands

  • View service status service mysqld status

  • Start the command service mysqld start

  • Shut down the command service mysqld stop

  • Restart command service mysqld restart

  • View MySql system configuration file cat /etc/my.cnf

  • Edit MySql system configuration file vi /etc/my.cnf

Intelligent Recommendation

mysql 5.7 this is incompatible with sql_mode=only_full_group_by

MySQL 5.7 version The default SQL configuration is: SQL_Mode = "Only_Full_Group_by", this configuration strictly implements "SQL92 Standard". SayNo aggregate functions, using group...

MySQL error [this is incompatible with sql_mode = only_full_group_by]

Report error message: 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 ...

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

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

Fractional resolution MySql this is incompatible with sql_mode=only_full_group_by

** Minute solution this is incompatible with sql_mode=only_full_group_by ** Second, the solution note Some students use navicat for mysql to execute temporary programs. The following error may be repo...

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

mysql [Err] 1055 this is incompatible with sql_mode=only_full_group_by

mysql [Err] 1055 this is incompatible with sql_mode=only_full_group_by Error log: The reason is clear The last sentence: sql_mode=only_full_group_by Query sql-model: select @@global.sql_mode; After th...

MySQL-this is incompatible with sql_mode = only_full_group_by Error Resolution

MySQL-this is incompatible with sql_mode = only_full_group_by Error Resolution Edit Profile Linux in: my.cnf In Windows: my.ini Add a line at the bottom Mysql restart the service to address Note: Usin...

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

Under mysql this is incompatible with sql_mode = only_full_group_by Solutions

Local testing is no problem, then deploy to client-server reported the following error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY claus...

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

Top