0

My back is giving me the usual:

...not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

I'm using mysql as a container, and I tried set sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; in all databases, for all users... And the error remains the same... Don't know what to do

rafaelpadu
  • 1,134
  • 2
  • 6
  • 20

1 Answers1

0

You could run

SET GLOBAL sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
SET SESSION sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';

And fix the problem temporary , but after MySQL restart the default settings will come back.

You need to set on your .cnf file below line and restart the MySQL server. Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/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"

I suggest better fix the queries rather than removing only_full_group_by

Ergest Basha
  • 7,870
  • 4
  • 8
  • 28
  • I can't find the /etc/my.cnf and /usr/local/etc/my.cnf files... I was able to change only the /etc/mysql/my.cnf... And it's not working on restart, is there anything I need to do? – rafaelpadu Mar 25 '22 at 19:54
  • @RafaelPáduaDelCorona what is your mysql version. Maybe you have different path of my.cnf. Check here https://stackoverflow.com/questions/580331/determine-which-mysql-configuration-file-is-being-used to find the configuration file – Ergest Basha Mar 26 '22 at 07:44