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

查看:36
本文介绍了如何在 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/en/sql-mode.html#sql-mode-fullhttps://mariadb.com/kb/en/mariadb/sql_mode/ 和其他相关网站.但是我的问题没有得到确切的答案.

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天全站免登陆