MySQL 1121: Out of range column value.

  1. Identify the query causing the error. Check application logs or enable the MySQL general log temporarily to capture the problematic SQL statement:


SET global general_log = 1;
SET global log_output = 'table';

After capturing the query, disable logging:
SET global general_log = 0;

  1. Examine the table schema for column definitions related to the error. Use the `DESCRIBE` command:


DESCRIBE yourtablename;

  1. Identify the column mentioned in the error and check its data type limits (e.g., INT, VARCHAR). Compare these limits with the data you are trying to insert or update.



  1. If the issue is due to an integer type limit (e.g., trying to insert a value larger than the maximum allowed for an INT), consider changing the column data type to a larger type (e.g., BIGINT) if data correctness allows:


ALTER TABLE yourtablename MODIFY yourcolumnname BIGINT;

  1. For VARCHAR or similar types, ensure the data you're inserting does not exceed the column's defined length. If necessary and appropriate, adjust the column length:


ALTER TABLE yourtablename MODIFY yourcolumnname VARCHAR(new_length);

  1. Re-run the problematic query to confirm the issue is resolved.



  1. Optionally, if the error persists or you suspect data corruption, check the table for issues:


CHECK TABLE yourtablename;

  1. If step 7 indicates table issues, attempt a table repair (back up the table first):


REPAIR TABLE yourtablename;

Never debug

MySQL

manually again

Let Dr. Droid create custom investigation plans for your infrastructure.

Book Demo
Automate Debugging for
MySQL
See how Dr. Droid creates investigation plans for your infrastructure.

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid