Home > Database > Mysql Tutorial > How to Enable or Disable Strict Mode in MySQL (XAMPP)?

How to Enable or Disable Strict Mode in MySQL (XAMPP)?

Patricia Arquette
Release: 2024-10-28 12:08:02
Original
476 people have browsed it

How to Enable or Disable Strict Mode in MySQL (XAMPP)?

Configuring MySQL Strict Mode in Localhost (XAMPP)

Question:

How do I determine the status of MySQL strict mode in localhost (XAMPP) and toggle it on or off as needed?

Solution:

Checking the Strict Mode Status:

To check if strict mode is enabled, run the following SQL query:

SHOW VARIABLES LIKE 'sql_mode';
Copy after login

If one of the values returned in the Value column is STRICT_TRANS_TABLES, then strict mode is enabled. Otherwise, it is disabled.

Disabling Strict Mode:

To disable strict mode, execute the following SQL query:

set global sql_mode='';
Copy after login

You can also specify any other SQL mode except STRICT_TRANS_TABLES. For example:

set global sql_mode='NO_ENGINE_SUBSTITUTION';
Copy after login

Enabling Strict Mode:

To re-enable strict mode, run the following SQL query:

set global sql_mode='STRICT_TRANS_TABLES';
Copy after login

Note:

The sql_mode variable can be set globally or for specific connections. The above queries modify the global setting. To set the mode for a specific connection, use the SET sql_mode command.

The above is the detailed content of How to Enable or Disable Strict Mode in MySQL (XAMPP)?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template