当前位置:网站首页>columns in GROUP BY clause; this is incompatible with sql_ mode=only_ full_ group_ By mysql8.0 solution
columns in GROUP BY clause; this is incompatible with sql_ mode=only_ full_ group_ By mysql8.0 solution
2022-07-26 04:39:00 【Zu'an Dalong】
Questions as follows :
ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘jol.solution.nick’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
reason :
mysql5.7 The above is enabled by default only_full_group_by Options . My version is mysql8.0 The above
Windows terms of settlement :
Query and view first sql_mode The content in
select @@GLOBAL.sql_mode;
+-----------------------------------------------------------------------------------------------------------------------+
| @@GLOBAL.sql_mode |
+-----------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION |
+-----------------------------------------------------------------------------------------------------------------------+
There are two solutions , The first is temporary solution , No cure , This problem will reappear when the database is restarted , The second is to modify my.ini The configuration file , Permanent cure , It's also convenient
Way 1:
Will find out sql_mode in ONLY_FULL_GROUP_BY Just delete it , Restart will fail
set @@GLOBAL.sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
Way 2:
Find yourself first mysql The installation path
select @@basedir;
+-----------+
| @@basedir |
+-----------+
| E:\mysql\ |
+-----------+
Then go into the folder and find your own my.ini The configuration file , modify [mysqld] The content in , Add the following content 

Be sure to add it to [mysqld] Inside , It's the following line of code , Is what will be found sql_mode in ONLY_FULL_GROUP_BY delete
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
Then exit the database , Restart in the service MySQL Can 
Ubuntu System /Linux System solutions
My database configuration file exists /etc/mysql/mysql.conf.d/mysqld.cnf in , So open this file directly
vim /etc/mysql/mysql.conf.d/mysqld.cnf
Type after opening the file
i # Insert command
Will enter this configuration file 
This may happen. It's useless to slide the mouse wheel , Use the keyboard keys to pull down 
Follow windows equally , add to sql_mode, Also delete ONLY_FULL_GROUP_BY The last string of things , After entering, type Esc, Will exit the insert mode , Then type :wq Press enter to save the file , Then restart MySQL Can
Restart command :
sudo service mysql restart
Then enter MySQL Enter the following code to view , that will do
select @@GLOBAL.sql_mode;

边栏推荐
- Spark Structured Streaming HelloWorld
- Throttling anti shake function of JS handwritten function
- UE4 controls the rotation of objects by pressing keys
- Creative design principle of youth maker Education
- Cnosdb Nirvana Rebirth: abandon go and fully embrace rust
- ES6 modularization +commonjs
- Recursive implementation of exponential enumeration
- UE4 获取玩家控制权的两种方式
- 嵌入式实操----基于RT1170 FreeRTOS实现CPU使用率统计(二十四)
- Phaser (I): platform jumping collection game
猜你喜欢
随机推荐
Customer service relationship management based on SQL net enterprise messenger enterprise communications
Is this my vs not connected to the database
Whether the SQL that fails to execute MySQL is counted into the slow query?
UE4 键盘控制开关灯
数组排序3
Throttling anti shake function of JS handwritten function
[300 + selected interview questions from big companies continued to share] big data operation and maintenance sharp knife interview question column (VIII)
Analyzing the curriculum design evaluation system of steam Education
数据库连接数查看和修改
egg-sequelize TS编写
二、国际知名项目-HelloWorld
2022河南萌新联赛第(三)场:河南大学 L - 合成游戏
数据仓库
2022杭电多校第二场 A.Static Query on Tree(树剖)
Weights & Biases (二)
人脸数据库收集总结
Page pull-up refresh and pull-down loading
擅长C(暑假每日一题 6)
Integrated architecture of performance and cost: modular architecture
MySQL - multi table query - Cartesian product sum, correct multi table query, equivalent connection and unequal connection, inner connection and outer connection









