今儿在分类查询时Mysql报错,1055 - Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'lyhz.r.river_picture' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode
百度时有不少都说进入mysql控制台运行语句啥的,跑了一遍都没有效果,实际解决问题用的下面这种方法,当前测试服务器Ubuntu:
解决方法:
1.sudo vim /etc/mysql/conf.d/mysql.cnf
2.在配置文件最后一行粘贴以下语句
[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
3.保存退出后
sudo service mysql restart to restart MySQL
以下贴出参考链接
https://stackoverflow.com/questions/37951742/1055-expression-of-select-list-is-not-in-group-by-clause-and-contains-nonaggr