如何在localhost(xampp)中打开/关闭MySQL严格模式? [英] How to turn on/off MySQL strict mode in localhost (xampp)?

查看:137
本文介绍了如何在localhost(xampp)中打开/关闭MySQL严格模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何检查localhost(xampp)中MySQL严格模式是打开还是关闭.

I want to know how to check whether MySQL strict mode is on or off in localhost(xampp).

如果打开,则说明什么模式以及如何关闭.

If on then for what modes and how to off.

如果关闭,则如何打开.

If off then how to on.

我已经关注了 http://dev.mysql.com/doc/refman/5.7/zh-CN/sql-mode.html#sql-mode-full

I already followed http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-full and https://mariadb.com/kb/en/mariadb/sql_mode/ and other related sites too. But I didn't get an exact answer for my question.

推荐答案

-> STRICT_TRANS_TABLES 负责设置MySQL严格模式.

->STRICT_TRANS_TABLES is responsible for setting MySQL strict mode.

-> 要检查是否启用了严格模式,请运行以下sql:

->To check whether strict mode is enabled or not run the below sql:

SHOW VARIABLES LIKE 'sql_mode';

如果值之一是 STRICT_TRANS_TABLES ,则启用严格模式,否则不启用. 就我而言,它给了

If one of the value is STRICT_TRANS_TABLES, then strict mode is enabled, else not. In my case it gave

+--------------+------------------------------------------+ 
|Variable_name |Value                                     |
+--------------+------------------------------------------+
|sql_mode      |STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION|
+--------------+------------------------------------------+

在我的情况下,

因此启用了严格模式,因为其中一个值为 STRICT_TRANS_TABLES .

Hence strict mode is enabled in my case as one of the value is STRICT_TRANS_TABLES.

-> 要禁用严格模式,请运行以下sql:

->To disable strict mode run the below sql:

set global sql_mode='';

[或STRICT_TRANS_TABLES以外的任何模式.例如:设置全局sql_mode ='NO_ENGINE_SUBSTITUTION';]

[or any mode except STRICT_TRANS_TABLES. Ex: set global sql_mode='NO_ENGINE_SUBSTITUTION';]

->要再次启用严格模式,请运行以下sql:

->To again enable strict mode run the below sql:

set global sql_mode='STRICT_TRANS_TABLES';

这篇关于如何在localhost(xampp)中打开/关闭MySQL严格模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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