the reason:
MySQL 5.7.5 and more functional dependency detection. If ONLY_FULL_GROUP_BY SQL mode is enabled (default), MySQL will refuse to select a list of query conditions or ORDER BY HAVING a list of references to non-aggregate column in the GROUP BY clause is neither named nor on their functionality.
(Prior to 5.7.5, MySQL does not detect functional dependencies, is not enabled by default ONLY_FULL_GROUP_BY. For a description of the behavior before 5.7.5, see "MySQL 5.6 Reference Manual.")
A. Temporary solve
终端执行 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’;
If NO_AUTO_CREATE_USER error, remove it again executed.
set @@global.sql_mode = ‘STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION’;
NOTE: This method will expire after the restart MySQL.
II. From the fundamental solution
Terminal performs sudo vim /etc/mysql/conf.d/mysql.cnf
Paste the following text:
[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
Save and exit
Restart service sudo service mysql restart mysql
If that fails, remove NO_AUTO_CREATE_USER, save and exit to restart
Record Date: August 21, 2019 20:29:46