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?
我没有更改文件/etc/mysql/my.cnf
,而是应用了/etc/mysql/mysql.conf.d/mysqld.cnf
文件中的更改,它终于奏效了。
在 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";
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.