Home > Database > Mysql Tutorial > body text

How to Check, Enable, and Disable Strict Mode in MySQL (XAMPP)?

Patricia Arquette
Release: 2024-10-26 21:53:03
Original
465 people have browsed it

How to Check, Enable, and Disable Strict Mode in MySQL (XAMPP)?

Understanding MySQL Strict Mode in Localhost (XAMPP)

MySQL strict mode enforces data integrity by rejecting queries that do not conform to certain rules. In XAMPP, checking the status of strict mode and modifying its settings are essential for ensuring data accuracy.

Checking Strict Mode Status

To determine if strict mode is enabled in your localhost XAMPP setup, run the following SQL command:

<code class="sql">SHOW VARIABLES LIKE 'sql_mode';</code>
Copy after login

If the output includes the value STRICT_TRANS_TABLES, then strict mode is enabled.

Disabling Strict Mode

To disable strict mode, execute the following SQL command:

<code class="sql">SET GLOBAL sql_mode='';</code>
Copy after login

Alternatively, you can specify any mode other than STRICT_TRANS_TABLES, such as:

<code class="sql">SET GLOBAL sql_mode='NO_ENGINE_SUBSTITUTION';</code>
Copy after login

Enabling Strict Mode

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

<code class="sql">SET GLOBAL sql_mode='STRICT_TRANS_TABLES';</code>
Copy after login

By adjusting the sql_mode variable, you can ensure that MySQL enforces data integrity rules as per your requirements.

The above is the detailed content of How to Check, Enable, and 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!