ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'uplooking.t1.age' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
root@SH_MySQL-01 09:50: [uplooking]> select uname,age,count(id) from t1 group by uname; ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'uplooking.t1.age' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
退出后再新开会话进行查询
root@SH_MySQL-01 09:50: [uplooking]> exit Bye [root@sh_01 ~]# booboo mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 14 Server version: 5.7.17-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
root@SH_MySQL-01 09:51: [uplooking]> select @@global.sql_mode; +------------------------------------------------------------------------------------------------------------------------+ | @@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 | +------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
root@SH_MySQL-01 09:51: [uplooking]> select uname,age,count(id) from t1 group by uname; +-------+------+-----------+ | uname | age | count(id) | +-------+------+-----------+ | a | 11 | 1 | +-------+------+-----------+ 1 row in set (0.00 sec)