如何全局启用mysql严格模式并保持它? [英] How to enable mysql strict mode globally and have it stay on?

查看:50
本文介绍了如何全局启用mysql严格模式并保持它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在全局范围内启用 MySQL 严格模式,并让它保持开启状态?

How do I enable MySQL strict mode globally, and have it stay on?

我已经尝试过这些命令:

I have tried these commands:

SET sql_mode = TRADITIONAL;
SET sql_mode = ANSI_QUOTES;

但他们只为当前会话设置模式.

But they only set the mode for the current session.

推荐答案

要在服务器启动时设置 SQL 模式,请使用:- 命令行上的 --sql-mode="modes" 选项,或- 选项文件中的 sql-mode="modes",例如 my.cnf(Unix 操作系统)或 my.ini(Windows).(modes"是用逗号分隔的不同模式的列表.)

To set the SQL mode at server startup, use: - the --sql-mode="modes" option on the command line, or - sql-mode="modes" in an option file such as my.cnf (Unix operating systems) or my.ini (Windows). ("modes" is a list of different modes separated by commas.)

参考:https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html

这篇关于如何全局启用mysql严格模式并保持它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆