mysqlubuntusql-mode

MySQL won't start after changin my.cf


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?


Solution

  • 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.