解决Navicat Premium终端操作mysql ONLY_FULL_GROUP_BY错误

时间:2023-03-08 16:55:17
解决Navicat Premium终端操作mysql ONLY_FULL_GROUP_BY错误
解决navicate终端操作mysql ONLY_FULL_GROUP_BY错误
  问题描述:
[Err] 1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'xxx.xxx.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
    产生原因:
    解决方法:
        1 会话级别 修改环境变量
        2 全局级别 修改环境变量
        3 修改Mysql配置文件 需要重启Mysql服务生效
mysql>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_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+----------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql>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'

https://www.xue163.com/588880/39193/391931881.html