mysql多表联合查询 [Err] 1055

在 mysql进行 多表联合查询, 出现以下错误:

[Err] 1055 - Expression #1 of SELECT list is not in GROUP BY clause
which is not functionally dependent on columns in GROUP BY clause; 
this is incompatible with sql_mode=only_full_group_by

在终端 vim /etc/mysql/my.cnf, 按 i  进入插入模式.

在 [mysqld] 下面添加:

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

然后 按 esc,  输入 :wq 保存.

输入以下命令重启MySQL:  systemctl restart mysqld

然后再尝试执行多表联合查询的语句, 可以正常查询.

原文地址:https://www.cnblogs.com/levia/p/14840713.html