問題描述
我在一個網站上工作,我收到了這個 MySQL 錯誤:
I'm working on a website and I'm getting this MySQL error:
"(...) 這與 sql_mode=only_full_group_by (...) 不兼容"
"(...) this is incompatible with sql_mode=only_full_group_by (...)"
我一直在尋找答案,但我意識到我必須更改 MySQL 的 sql_mode.所以我在/etc/mysql/my.cnf 中添加了以下行:
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"
但是現在當我執行 sudo service mysql restart
時,它需要很長時間,然后顯示此消息:
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.
所以現在我刪除了該行,每次啟動 PC 時都必須手動執行該命令.
So now I removed that line and I have to execute the command by hand everytime I boot my PC.
有人可以幫我嗎?
推薦答案
我沒有更改文件 /etc/mysql/my.cnf
,而是應用了 /etc/中的更改mysql/mysql.conf.d/mysqld.cnf
文件,終于成功了.
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.
這篇關于更改 my.cf 后 MySQL 無法啟動的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!