2

I'm working on a website and I'm getting this MySQL error:

"(...) this is incompatible with sql_mode=only_full_group_by (...)"

I've looked for an answer and I realized I had to change the sql_mode of my MySQL. So I've added the following line to /etc/mysql/my.cnf:

sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

But now when I executed sudo service mysql restart it takes a really long time and then shows this message:

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

So now I removed that line and I have to execute the command by hand everytime I boot my PC.

Can anyone help me?

tarzanbappa
  • 4,930
  • 22
  • 75
  • 117
Alexandre Justino
  • 1,716
  • 1
  • 19
  • 28

3 Answers3

1

Instead of changing the file /etc/mysql/my.cnf, I applied the changes in the /etc/mysql/mysql.conf.d/mysqld.cnf file and it worked, finally.

Alexandre Justino
  • 1,716
  • 1
  • 19
  • 28
0

Remove sql mode in my.cnf and restart the mysql service then execute the bellow query.

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";
0

If you are editing my.cf directly, you need to remove the quotes.

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Referenced here and working for me: https://gist.github.com/cucxabeng/938b55b3e8b8f1bf230edbf043254189