gpt4 book ai didi

mysql重启后恢复ONLY_FULL_GROUP_BY

转载 作者:行者123 更新时间:2023-11-29 01:09:43 24 4
gpt4 key购买 nike

我遵循了 this SO question 的第二个答案禁用全局选项ONLY_FULL_GROUP_BY。

mysql> SELECT @@sql_mode;
+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@sql_mode |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0,00 sec)


mysql> SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
Query OK, 0 rows affected (0,00 sec)


mysql> SELECT @@sql_mode;
+------------------------------------------------------------------------------------------------------------------------+
| @@sql_mode |
+------------------------------------------------------------------------------------------------------------------------+
| STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+------------------------------------------------------------------------------------------------------------------------+
1 row in set (0,00 sec)

刚刚发现重启mysql服务后,这个选项又恢复了。

这是我的环境

Server: Localhost via UNIX socket
MySQL 5.7.17-0ubuntu0.16.04.1
Ubuntu 16.04

我认为它在其中一个配置文件中,但我找不到它。你能告诉我它在哪里或者如何永久禁用它吗?

最佳答案

发现:

我必须在 /etc/mysql/mysql.conf.d/mysqld.cnf 中添加一个新行

[mysqld]部分的末尾,我添加了

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 systemctl restart mysql

我的设置现在在重启后保留。

关于mysql重启后恢复ONLY_FULL_GROUP_BY,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42155304/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com