INSERT or UPDATE data in a table, the operation fails, and the database system returns an error message similar to:
SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'column_name' at row y: INSERT INTO 'table_name'The error is caused by one of the following conditions:
EXPLAIN <table_name>;AUTO_INCREMENT column, check to make sure the next AUTO_INCREMENT value falls within the allowable range for the column data type. Retrieve the current AUTO_INCREMENT value with:
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = "<table_name>";AUTO_INCREMENT value is at or near its maximum value, consider the following options:
ALTER TABLE <table_name> MODIFY <column_name> BIGINT;AUTO_INCREMENT value. Warning: This will delete all the data in the table. Ensure you have a backup before proceeding.
TRUNCATE TABLE <table_name>;Encountered error:
SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for co
lumn 'fid' at row 1: INSERT INTO "flood"
Resolution Steps:
mysql> EXPLAIN flood;
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| fid | int(11) | NO | PRI | NULL | auto_increment |
| event | varchar(64) | NO | MUL | | |
| identifier | varchar(128) | NO | | | |
| timestamp | int(11) | NO | | 0 | |
| expiration | int(11) | NO | MUL | 0 | |
+------------+--------------+------+-----+---------+----------------+SELECT AUTO_INCREMENT FROM information_schema.tables WHERE table_name = "flood";2147483647 (max for INT).
TRUNCATE TABLE flood;SELECT AUTO_INCREMENT FROM information_schema.tables WHERE table_name = "flood";1.
Truncation resolved the issue, allowing new rows to be inserted without error.