[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregate...

使用Navicat for MySQL时,创建表语句执行后,表虽然创建成功了,但是会报错,
错误信息如下:


创建表语句成功后报错.png
  • 查看SQL的模式
    show variables like '%sql_mode%';
    SQL的模式.png

    存在ONLY_FULL_GROUP_BY
  • 在myql配置文件中(my.ini文件)重新对sql_mode 赋值
    sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
    my.ini文件.png

SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

你可能感兴趣的:([Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregate...)