Skip to content

Instantly share code, notes, and snippets.

@jsonzilla
Created June 29, 2023 22:58
Show Gist options
  • Save jsonzilla/31cf52aa4fa3945d7aceaf552213e2cd to your computer and use it in GitHub Desktop.
Save jsonzilla/31cf52aa4fa3945d7aceaf552213e2cd to your computer and use it in GitHub Desktop.

Fix ONLY_FULL_GROUP_BY error

Reference

List all curent global modes in MySql

mysql -sse "SELECT @@GLOBAL.sql_mode;" 

or direct in a sql in

SELECT @@GLOBAL.sql_mode;

example of output

STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION,ONLY_FULL_GROUP_BY 

Open the /etc/mysql/mysql.conf.d with sudo or root and add the line below without ONLY_FULL_GROUP_BY

sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION

Restart MySql Server

/etc/init.d/mysqld restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment