Mysql error 1366-Incorrect integer value how to solve?
This article mainly introduces how to solve the Mysql error 1366-Incorrect integer value. This article solves the problem by modifying the default value of the field. For more information, see
Because this database server stores many databases and all of them are small databases, it initially runs on a windows server. Some time ago, due to the need to adjust the server room, I made adjustments to the database migration and front-end applications on a quiet night, after the adjustment, the test application can be accessed normally, and then I leave.
When I first got to work on Monday, I received feedback: the following error was reported when an article was published on the website background:
The Code is as follows:
Insert into doc_main (title, typeid, uptime, intro, ifhot, imgurl1, doctype, fileurl1, shunxu, titleurl, qitype) values ('test', '13 ', '2014-5-30 ', 'test', '1', '', '0','', '123 ')
Cause analysis process:
At first, I thought it was a problem with the database file, but after comparing the old and new database files, I did not find any exceptions. I initially decided it should be a problem with the database application, so I copied the preceding SQL statement and executed it directly on the mysql server. The execution result was disappointing and the following error was reported:
The Code is as follows:
[SQL] insert into doc_main (title, typeid, uptime, intro, ifhot, imgurl1, doctype, fileurl1, shunxu, titleurl, qitype) values ('test', '13 ', '2014-5-30 ', 'test', '1', '', '0','', '123 ')
[Err] 1366-Incorrect integer value: ''for column 'shunxu 'at row 1
After viewing the data table, it is found that the shunxu field requires an integer, and the default value is null. change its default value to 0. Restart the mysql service and test OK.