MySQL-this is incompatible with sql_mode=only_full_group_By error resolution
1. Principle level
this error occurs in MySQL version 5.7 and above:
The default sql configuration for mysql 5.7 is: sql_mode="ONLY_FULL_GROUP_BY", which strictly enforces the "SQL92 standard".
When upgrading from 5.6 to 5.7, most of them choose to adjust sql_mode to make it consistent with 5.6 in order to be as compatible as possible with the program.
2. SQL level
In sql execution, the cause appears.
Simply put: the output is called target list, which is the field followed by select, and a place group by column, which is
group by followed by the field. Because the ONLY_FULL_GROUP_BY setting is turned on, so if a field is not in the target list
and group by fields, or the value of the aggregation function, then this sql query is considered illegal by mysql and will report an error.
Translated with www.DeepL.com/Translator (free version)
1. View the statement of SQL_mode is as follows
select @@GLOBAL.sql_mode;
Second, the solution – (recommended solution two)
① solution one: sql statement temporarily modify sql_mode
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
Question.
After restarting the mysql database service, ONLY_FULL_GROUP_BY will still appear.
② Solution 2: perfect solution.
To modify the MySQL configuration file, add SQL manually_ Mode is mandatory. Only is not required_ FULL_ GROUP_ By attribute,
VI/etc/my. CNF
Add or modify configuration file:
sql_mode =‘STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISIN_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION’
Restart the MySQL service and solve it successfully.
service mysqld restart
Read More:
- MYSQL gruop by Error: this is incompatible with sql_mode=only_full_group_by
- [Solved] MYSQL 5.7 gruop by eRROR: this is incompatible with sql_mode=only_full_group_by
- [Solved] MySQL Error: “Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre”
- [Solved] Sequelize DatabaseError: ER_WRONG_FIELD_WITH_GROUP: Expression #2 of SELECT list is not in GROUP
- [MySQL] The principle of group by aggregation function and the reason for aggregation limitation SELECT list is not in GROUP BY clause and contains nonaggregated column
- [Solved] MYSQL Start Project Error: this is incompatible with sql_mode=only_full_group_by
- [Solved] MySQL Error: ERROR 1055 (42000)sql_mode=only_full_group_by
- [Solved] ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregate
- [Two Methods] Ora-00904: invalid group by error identifier
- SQL Server Group sort de duplication row_ number() over ( PARTITION BY t1.col_ 2 ORDER BY 1 )
- Mysql :error 1111. Invalid use of group function
- How to Solve mysql [Err] 1067-Invalid default value for
- postgresql-Database query problem-ERROR: column “t.domainid“ must appear in the GROUP BY clause or be used in an a
- How to Solve can‘t connect to local mysql server through socket ‘/var/lib/mysql/mysql.sock‘
- How to Solve MYSQL Error: Failed to start MySQL 8.0 database server
- MYSQL Insert Data Error: check the manual that corresponds to your MySQL server version for the right syntax
- Docker: How to Solve MYSQL8 & Navicat remote connection error
- How to Solve Mysql8 load data error
- How to Fix MySQL ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this MySQL server
- How to Solve c3p0 connect mysql8.0 Error