Home > Software engineering >  Out of range value for column 'id' at row 1 in MYSQL
Out of range value for column 'id' at row 1 in MYSQL

Time:04-19

When I am trying to insert something to my table I am getting this error on my network tab. "Out of range value for column 'id' at row 1"

In my database table ID column have the following properties. id --> int(11), not null, auto-increment.

and I am trying to insert the following details to my table

          INSERT INTO `my_table` (`type_id`, `email`, `p_name`, `status`, `call`) 
          VALUES (4, '[email protected]', 'Self', '0', '1')

I had also tried passing null to ID while inserting it into the DB table, but it didn't work.

CodePudding user response:

Likely your auto increment column id has grown large and the next auto increment value (which is generated with the insert statement) has become too large for it. You can confirm this by checking what is the current auto increment value

select  `AUTO_INCREMENT`
from  INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = <your db name> 
and   TABLE_NAME   = `my_table`;

reference : https://dev.mysql.com/doc/mysql-tutorial-excerpt/5.7/en/example-auto-increment.html

  • Related