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?

4

3 回答 3

1

我没有更改文件/etc/mysql/my.cnf,而是应用了文件中的更改/etc/mysql/mysql.conf.d/mysqld.cnf并且它最终起作用了。

于 2016-06-22T21:09:29.747 回答
0

如果您直接编辑 my.cf,则需要删除引号。

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

在这里引用并为我工作:https ://gist.github.com/cucxabeng/938b55b3e8b8f1bf230edbf043254189

于 2020-04-05T14:49:17.990 回答
0

删除 my.cnf 中的 sql 模式并重新启动 mysql 服务,然后执行以下查询。

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";
于 2016-06-21T05:32:03.783 回答