1、查看sql_mode
select @@sql_mode show variables like '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
2、停止Mysql服务:
root@localhost:/etc/mysql/mysql.conf.d# service mysql stop
3、去掉ONLY_FULL_GROUP_BY,重新设置值。
root@localhost:/etc/mysql/mysql.conf.d# nano mysqld.cnf
输入或复制以下内容:
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
重新加载mysql配置文件:
root@localhost:/etc/mysql/mysql.conf.d# service apparmor reload
重启Mysql:
root@localhost:/etc/mysql/mysql.conf.d# service mysql start