Solve the error reported when modifying table attributes in the database: 1138-Invalid use of NULL value

Record, the database error encountered when writing code today, the specific error information is as follows:

 

Pre-scenario: When writing logic, it is found that there is a field in the database that needs to be set to not null. After going to the database design table and saving the table structure, the above error message appears.

A brief analysis of the reason: the high probability is that the field in the database already has a null value, and it is easy to solve it after knowing the reason

For example: the name of a piece of data in the table is (null), and you want to modify the name field to not null, and there is a conflict between the two~

Solution! ! ! Pro test is effective

Give the empty value of the field in the table a data to make it not null. Then click save and there will be no error

Guess you like

Origin blog.csdn.net/weixin_45730522/article/details/130417278