如何摆脱MySQL中的STRICT SQL模式 [英] How to get rid of STRICT SQL mode in MySQL
问题描述
这是此问题的后续 MYSQL不正确的DATETIME格式
如何一劳永逸地摆脱STRICT_TRANS_TABLES?
How to get rid of STRICT_TRANS_TABLES once and for all?
mysql --help
报告以下配置:
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf
$ ls /etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf
ls: /Users/pain/.my.cnf: No such file or directory
ls: /etc/mysql/my.cnf: No such file or directory
ls: /usr/local/etc/my.cnf: No such file or directory
/etc/my.cnf
$ cat /etc/my.cnf
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION
但这没有帮助。我有一些遗留代码,每次重新启动计算机我必须启动mysql和更改sql_mode。
But this doesn't help. I have some legacy code and each time I reboot the computer I have to launch mysql and change sql_mode.
更新
所以我放弃了自己安装的MySQL并从mysql.com下载它。但这也没有帮助。以下答案:如何修复`未知变量'sql-mode =我试过不同的变化 /etc/my.cnf
: [mysql]
, [mysqld]
, sql_mode
, sql-mode
没有帮助。
So I gave up on Homebrew-installed MySQL and downloaded it from from mysql.com. But that didn't help either. Following the answers here: How to fix `unknown variable 'sql-mode=ANSI'`? I have tried different variations of /etc/my.cnf
: [mysql]
, [mysqld]
, sql_mode
, sql-mode
– nothing helped.
推荐答案
所以最后我删除了MySQL服务器,我从mysql.com,重新安装它通过Homebrew和不得不编辑
So in the end I removed the MySQL Server I got from the mysql.com, reinstalled it via Homebrew and had to edit
/usr/local/Cellar/mysql/5.6.xx/my.cnf
在哪里可以注释掉 STRICT_TRANS_TABLES
。
然而这不解释为什么默认配置覆盖了来自 /etc/my.cnf
的一个,但我花了太多时间这已经是它。和方式我仍然不知道如何处理mysql.com提供的分布。
However this doesn't explain why the default config overrides the one from /etc/my.cnf
, but I spent too much time on this already as it is. And by the way I am still not sure what to do with the mysql.com provided distribution.
这篇关于如何摆脱MySQL中的STRICT SQL模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!