This article mainly introduces Mysql error 1366 because this database server stores many databases and all of them are small databases, it was initially run 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.
Of course, you can refer to the article "MySQL 5 cannot create automatically added fields" in this blog and comment out SQL-mode to solve the above problem.