Mysql Field ' * * * ' doesn ' t have a default value error resolution _MYSQL

Source: Internet
Author: User

Today, the Chinese blog Alliance has bo friends feedback, zgboke.com can not submit blog, I was just ready to go to the Holiday Plaza Party, on the rush to submit a trial, found that the blog submitted when the following error is reported:

Tip Web_pic cannot be a null value. I am very puzzled, can be successfully submitted before, why suddenly die? Looked at the case on the Internet, said it is necessary to modify the configuration of MySQL, but the current blog Federation is hung in Beijing East Cloud engine, the database can not modify the configuration, logically said before the normal submission, the back should also be able to ah!

As the time for the party was coming, it was put aside first. Back home, compared to the next online case, the original is web_pic this key value is not empty caused, that is, when the table was created, using the NOT NULL property. So into the mywebsql, log into the Beijing East Cloud Engine database, carried out the following operations:

After submitting, the discovery can be successfully submitted! The desire to appear this wrong, should be I recently imported export database too frequently, create tables statement error caused.

Below, sorting out the same problem on the Internet other solutions to facilitate the problem of students to refer to:

1, open My.ini, find

Sql-mode= "Strict_trans_tables,no_auto_create_user,no_engine_substitution"

Amended to

Sql-mode= "No_auto_create_user,no_engine_substitution"

and restart MySQL.

2, MySQL 5 uses a strict mode which needs to be disabled.

In Windows, Goto start-->programs-->mysql->mysql Instance Config Wizard. Follow through the reconfigure Instance option-->detailed configuration-->continue Next a few. At the bottom under Enable TCP/IP option there is ' Enable Strict Mode '. Deslect This option (no tick). Save changes and MySQL'll restart.

3, look at your database definition is not the primary key generated by the way set to int, but not set to the self-increase!! Or you can set a default value when the data is defined.

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.