Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何全局启用 MySQL 严格模式并使其保持开启状态?
我试过这些命令:
SET sql_mode = TRADITIONAL; SET sql_mode = ANSI_QUOTES;
但他们只为当前会话设置模式。
要在服务器启动时设置 SQL 模式,请使用: ---sql-mode="modes"命令行上的选项,或 -sql-mode="modes"在my.cnf(Unix 操作系统)或 my.ini (Windows) 等选项文件中。(“modes”是用逗号分隔的不同模式的列表。)
--sql-mode="modes"
sql-mode="modes"
my.cnf
参考:https ://dev.mysql.com/doc/refman/5.0/en/sql-mode.html