(This setup may not work, you can try mode 2)
Reference resources:
https://blog.csdn.net/liuyunshengsir/article/details/79525031
1. -- Query Global sql_mode,Remove ONLY_FULL_GROUP_BY select @@sql_mode; -- results of enforcement ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION 2. In two cases -- Existing databases, execute modification commands under the current database (valid for existing databases) set sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; -- New databases need to be modified globally sql_mode(Effective for newly built databases) set @@sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
Two.
Reference https://blog.csdn.net/spirit_8023/article/details/83105030
1. View the original sql_mode value
-- mysql Execute two commands separately to see two execution results SHOW SESSION VARIABLES; SHOW GLOBAL VARIABLES; -- You can see the results of the query sql_mode The value is: -- ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
2. Modify sql_mode
-- Perform updates to the above two configurations sql_mode value(Delete the original data ONLY_FULL_GROUP_BY) set session sql_mode= 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; 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';
Three.
Every time you reboot your computer or mysql, it is annoying to prompt sql_mode=only_full_group_by error message. To get rid of it once and for all, you need to modify the configuration file and restart mysql:
Take linux as an example, edit / etc/my.cnf file, search sql_mode keyword, modify or add (sql_mode configuration needs to be placed under [mysqld] node):
# Solve the group_by query statement error problem: sql_mode=only_full_group_by
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Modify and restart mysql before and after configuration comparison:
https://www.cnblogs.com/52lnamp/p/9294330.html