tags: mysql
When using MySQL, the following query is performed:
select * from `sys_user_group` group by `GROUP_ID`
The error message is as follows:
[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 dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
The wrong reason is that my mysql version is 5.7, using the following statement query you know
select @@sql_mode;
It is set by default.
sql_mode=only_full_group_by
only_full_group_by: Using this is the same group rule as used and Oracle, the select of the select is in Group, or itself is the polymer column (SUM, AVG, MAX, MIN), in fact, this configuration is currently the personal feeling and Distinct, so Go out
Directly modify the mysql configuration file (my system is ubuntu16.04,/etc/mysql/mysql.conf.d/mysqld.cnf There is no SQL_Mode this configuration, so it is better, if it is other system, you don't have to add it)
[mysqld]
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 full configuration of this mysql configuration file is as follows:
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
lower_case_table_names=1
character-set-server=utf8
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
MySQL reasonable set of sql_mode sql model used to solve the following types of problems (1) By setting sql mode, can perform different stringency data check, data preparation of effective protection....
Solution my.cnf adds a piece of data sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION service mysqld restart resta...
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 th...
Other Other confidence in mysql under /etc/my.cnf under Linux...
1. Background My local mysql 8 executed a SQL error...
which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by When executing a colleague's sql, I found that group by has a problem. select m...
Error message solve I encountered a SQ pit today, recorded, longji Inappropriate reason Mainly group problems caused, the previous use of the list query, I thought it was a joint watch could not use G...
This problem occurs above Mysql5.7 because the default SQL configuration is: SQL_MODE = "Only_Full_Group_by". If it is developed directly on 5.7, it is recommended to use the Any_Value () fu...
The first way resolves: SQL optimization, using any_value () to reference the address. Such as: Any_ValueTo query the field name) The second way solves: modify the file, the file address is generally:...
Cause: The management platform dashboard shows that the aggregate query is abnormal, mysql5.7 under Linux (non-docker installation) Solution: Command line/graphic tool operation:select @@global.sql_mo...