- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How do I disable Strict Mode in MySQL?
The handling of missing or incorrect values in queries that change the data is governed by MySQL Strict Mode. This contains the CREATE TABLE, UPDATE, and INSERT statements. When attempting to process the query with MySQL Strict Mode enabled, which is the default setting, invalid or missing data may result in warnings or failures.
When Strict Mode is turned off, the identical query would have its missing or incorrect data modified and would result in a straightforward warning. This could appear to be the desired outcome, but with Strict Mode turned off, certain activities might have unanticipated effects. For instance, if a value is being added and it has more characters than the allowed number, it will be truncated to fit.
The strict mode for MySQL is always on. It can be disabled in a few different ways.
To Disable Strict Mode via SQL
The following command can be performed to disable strict mode on your MySQL server using this way.
mysql -u root -p -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';"
Now, you can verify that the mode is set by running the following −
mysql -u root -p -e "SELECT @@GLOBAL.sql_mode;"
Disable Strict Mode via my.cnf/my.ini:
To edit, launch the my.ini or my.cnf file (the file you have depends on whether you are running Windows or Linux).
Find the following line
sql_mode = "STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Change it to the following line:
Insert the line under the [mysqld] section if it cannot be found (if there is no [mysqld] section, create it).
Create mysqlId in the following way: sql_mode= ""
To make the modification effective, restart the MySQL service.
If restarting is not an option right now, you can get into the database server and use the command listed below to make the changes effective right away. If the aforementioned procedure is not carried out, the modification is lost the next time the MySQL service restarts.
set global sql_mode='';
No matter why a MySQL administrator has to disable Strict Mode, doing so is a simple process. You may disable MySQL Strict Mode on servers using this approach.
This rule applies to Standard Edition, Standard (Multi-Language) Edition, Enterprise Edition (MySQL), Enterprise Multi-Language Edition (MySQL), Enterprise Edition (SQL Server), and Enterprise Edition (MySQL) (SQL Server)
- Related Articles
- Strict Mode in ReactJS
- How to disable landscape mode in Android?
- How do I disable log messages from the Requests Python module?
- How to disable ONLY_FULL_GROUP_BY in MySQL?
- How do I lag columns in MySQL?
- How to enable / Disable Enhanced Protection Mode in Internet Explorer using PowerShell?
- How do I create a view in MySQL?
- How do I truncate tables properly in MySQL?