MySQL 如何查看sql_mode的具体值?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10591231/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I see the specific value of the sql_mode?
提问by Green
There are some sql_mode
values in MySQL:
sql_mode
MySQL中有一些值:
ANSI
,
ANSI
,
IGNORE_SPACE
,
IGNORE_SPACE
,
STRICT_TRANS_TABLES
, etc
STRICT_TRANS_TABLES
, 等等
How can I see the one particular value? The manual says:
我怎样才能看到一个特定的值?手册上说:
You can retrieve the current mode by issuing a SELECT @@sql_mode statement.
您可以通过发出 SELECT @@sql_mode 语句来检索当前模式。
But it just shows nothing, just one blank field in a table with @@sql_mode
as a column name.
但它什么也没显示,只是表中的一个空白字段@@sql_mode
作为列名。
回答by Ike Walker
It's only blank for you because you have not set the sql_mode. If you set it, then that query will show you the details:
它对您来说只是空白,因为您还没有设置 sql_mode。如果您设置它,那么该查询将向您显示详细信息:
mysql> SELECT @@sql_mode;
+------------+
| @@sql_mode |
+------------+
| |
+------------+
1 row in set (0.00 sec)
mysql> set sql_mode=ORACLE;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT @@sql_mode;
+----------------------------------------------------------------------------------------------------------------------+
| @@sql_mode |
+----------------------------------------------------------------------------------------------------------------------+
| PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER |
+----------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
回答by simhumileco
You can also try this to determine the current globalsql_mode
value:
你也可以试试这个来确定当前的全局sql_mode
值:
SELECT @@GLOBAL.sql_mode;
or sessionsql_mode
value:
或会话sql_mode
值:
SELECT @@SESSION.sql_mode;
I also had the feeling that SQL modewas indeed empty.
我也有一种感觉,SQL 模式确实是空的。