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


原因:

  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

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM