Some time ago, when I made a website, I used a MySQL database and EMS MySQL manager to create and manage databases. One of the tables has an auto-incrementing primary key ID, because the default auto-increment Data Type of the table created by EMS MySQL manager is tinyint, this problem was not noticed at the beginning. Today, I found that I cannot insert data into the database. The error is that 127 of the records in the ID column already exist! After checking the database, it exists, but the ID column is obviously auto-incrementing. I didn't specify the value of the ID column in the insert statement. Why does this problem occur?
After checking the database, I found that the data type of the ID column is tinyint, and then I thought how could it be such a special number as 127 (128-1? Later I thought whether tinyint can only represent-127 ~ What about the number between 127? As a result, I changed the data type to integer!
It seems that it is important to select the correct database data type.