[英]MySQL won't start after changin my.cf
I'm working on a website and I'm getting this MySQL error:我在一个网站上工作,我收到了这个 MySQL 错误:
"(...) this is incompatible with sql_mode=only_full_group_by (...)"
“(...) 这与 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.我一直在寻找答案,但我意识到我必须更改 MySQL 的 sql_mode。 So I've added the following line to /etc/mysql/my.cnf:
所以我在 /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:但是现在当我执行
sudo service mysql restart
它需要很长时间然后显示此消息:
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.所以现在我删除了该行,每次启动 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.如果直接编辑 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
Referenced here and working for me: https://gist.github.com/cucxabeng/938b55b3e8b8f1bf230edbf043254189在这里引用并为我工作: https : //gist.github.com/cucxabeng/938b55b3e8b8f1bf230edbf043254189
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.