About MySQL strict mode on, off

Source: Internet
Author: User

Because of some default settings in the project, and for various reasons, MySQL database needs to be developed in a non-strict mode (the most recent version of MySQL is turned on in strict mode by default).

Under Linux MySQL service, the following steps are:

1. Enter MySQL Service

2, the implementation of the set operation modification, our project is directly set to "

mysql> set global sql_mode= '; #这种方法修改, after the current session is invalidated, this modification is meaningless, and it is recommended to modify the configuration file in a way that modifies

3, after the modification, do not need to restart the MySQL service, effective immediately

4, check whether the effective, execute SQL

SELECT @ @sql_mode;

  

Modify by configuration file:

Linux Find my.cnf file

Window was modified by looking for My.ini.

Sql_mode=no_engine_substitution,strict_trans_tables

Strict mode is mainly used in the following scenarios

  • Inserting null values on NOT NULL fields is not supported
  • Inserting "value to self-growing field" is not supported
  • The text field is not supported with a default value

About MySQL strict mode on, off

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.