mysql報錯:Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre

項羽齊發表於2019-03-30

原因:

  https://blog.csdn.net/fansili/article/details/78664267

解決辦法:

  1:檢視mysql配置檔案位置

[root@localhost ~]# ps -ef | grep mysql
mysql      838     1  0 02:21 ?        00:00:00 /usr/sbin/mysqld --defaults-file=/etc/my.cnf
root      2035  1706  0 02:29 pts/0    00:00:00 grep --color=auto mysql

  2:開啟配置檔案

[root@localhost ~]# vim /etc/my.cnf

  3:修改配置:如果沒有該配置項,新增一個即可

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

  4:重啟mysql

[root@localhost ~]# systemctl restart mysql

  

相關文章