Skip to content

Instantly share code, notes, and snippets.

@cuonghuynh
Last active October 1, 2018 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cuonghuynh/a84c6708cd84df084b990c10944cac7e to your computer and use it in GitHub Desktop.
Save cuonghuynh/a84c6708cd84df084b990c10944cac7e to your computer and use it in GitHub Desktop.
Errors after upgrading mysql to 5.7

error-related-to-only-full-group-by-when-executing-a-query-in-mysq

As of MySQL 5.7.5, the default SQL mode includes ONLY_FULL_GROUP_BY which means when you are grouping rows and then selecting something out of that groups, you need to explicitly say which row should that selection be made from.

Fixing:

$ sudo vim /etc/mysql/my.cnf

Add them to bottom of file

[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

field-id-doesnt-have-a-default-value

Remove modes:

STRICT_TRANS_TABLES, STRICT_ALL_TABLES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment