Because the database server has a lot of databases and small databases, it was originally run on a Windows server. Some time ago due to the computer room server to make adjustments, so I will be in a night of nights on the migration of the database and the foreground application has been adjusted, after the adjustment after the test application can be normal access after I left.
Monday just go to work received feedback: Web site published articles reported as follows error:
Copy Code code as follows:
Insert into Doc_main (Title,typeid,uptime,intro,ifhot,imgurl1,doctype,fileurl1,shunxu,titleurl,qitype) VALUES (' Test ', ', ' 2011-5-30 ', ' Test ', ' 1 ', ', ' 0 ', ', ', ', ', ', ' 279 '
Reason Analysis Process:
At first I thought there was a problem with the database file, but compared to the old and new database files, did not find an exception, the preliminary judgment should be the database application problem, so I then copied the above SQL statement directly on the MySQL server execution, the results are disappointing, reported the following error:
Copy Code code as follows:
[SQL] INSERT INTO Doc_main (Title,typeid,uptime,intro,ifhot,imgurl1,doctype,fileurl1,shunxu,titleurl,qitype) values (' Test ', ', ' 2011-5-30 ', ' Test ', ' 1 ', ', ' 0 ', ', ', ', ', ', ', ' 279 ')
[ERR] 1366-incorrect integer value: ' For column ' Shunxu ' at row 1
After viewing the datasheet, we found that the Shunxu field requires an integer, and the default is null, changing its default value to 0. After restarting the MySQL service, test OK.
Of course, you can also refer to the blog in the "MySQL 5 can not create automatically added fields" article, comments off Sql-mode can also solve the above problems.