[英]How can I see the specific value of the sql_mode?
There are some sql_mode
values in MySQL: MySQL 中有一些
sql_mode
值:
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
作为列名。
It's only blank for you because you have not set the sql_mode.它对您来说只是空白,因为您还没有设置 sql_mode。 If you set it, then that query will show you the details:
如果您设置它,那么该查询将向您显示详细信息:
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)
You can also try this to determine the current global sql_mode
value:你也可以试试这个来确定当前的全局
sql_mode
值:
SELECT @@GLOBAL.sql_mode;
or session sql_mode
value:或会话
sql_mode
值:
SELECT @@SESSION.sql_mode;
I also had the feeling that the SQL mode was indeed empty.我也有一种感觉, SQL 模式确实是空的。
You need to login to your mysql terminal first using mysql -u username -p password
您需要先使用
mysql -u username -p password
登录到您的 mysql 终端
Then use this:然后使用这个:
SELECT @@sql_mode; or SELECT @@GLOBAL.sql_mode;
output will be like this:输出将是这样的:
STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUB STRICT_TRANS_TABLES、STRICT_ALL_TABLES、NO_ZERO_IN_DATE、NO_ZERO_DATE、ERROR_FOR_DIVISION_BY_ZERO、TRADITIONAL、NO_AUTO_CREATE_USER、NO_ENGINE_SUB
You can also set sql mode by this:您还可以通过以下方式设置 sql 模式:
SET GLOBAL sql_mode=TRADITIONAL;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.