MySQL 5.7.5+ でのGROUP BYエラー

  • 9
    Like
  • 0
    Comment
More than 1 year has passed since last update.

メモ

結論

  • 5.7.5で仕様変わったから、my.cnfを変更して、前の動作させる

エラー内容

Error: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'arashi_cake_web.c.name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

設定

my.cnf
[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

参考