Recently MySQL 5.1.49 (OSX) started inserting the same value ‘2147483647’ for ALL integer fields named id and set as primary key. This is happening for all databases and all tables. Here’s the a quick example:
mysql> INSERT INTO packages(id,name,rate) VALUES ('37364428662',"Testing","300");
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> SELECT * FROM packages;
+------------+---------+------+
| id | name | rate |
+------------+---------+------+
| 2147483647 | Testing | 300 |
+------------+---------+------+
1 row in set (0.00 sec)
mysql>
I’m attempting to re-install MYSQL as nothing else seems to be working : / I’ll post any solutions I manage but meanwhile any help is always appreciated!
It’s probably because your
idfield is a 32 bit integer and the value 37364428662 will require more than 32 bits to store. Try changing the type ofidto an unsigned int, or some larger integer type.It appears when you try to enter 37364428662 it’s defaulting to the largest possible value for an int 32 (2147483647).