Software⏱️ 4 min read📅 2026-06-04

How to Fix Error 1264 Error – MySQL Error 1264: out of range value for column

MySQL Error 1264: out of range value for column

Quick Answer: The error occurs because the data type you specified (integer(10)) is too small to hold the value '3172978990'. Consider changing the data type to a larger integer, such as integer(20) or decimal(10,2), to accommodate the value.

MySQL Error 1264: out of range value for column occurs when you attempt to insert a value into a column that is defined as an integer but exceeds the maximum limit of that data type. This error specifically affects users who are not familiar with the limitations of MySQL's integer data types.

This error can be frustrating because it prevents you from successfully inserting data into your database table, which can have significant consequences for your application or system. In this guide, we will walk you through the root causes of this error and provide two primary methods to resolve it.

💡 Why You Are Getting This Error

  • The first main reason why MySQL Error 1264 occurs is due to the definition of the column in your table. If the column is defined as an integer with a specific length, such as `integer(10)`, you cannot insert values that exceed the maximum limit of that data type. For example, if the column is defined as `integer(10)` but you try to insert a value greater than 2147483647 (the maximum limit for a 32-bit signed integer), MySQL will throw this error.
  • Another alternative reason why this error may occur is due to the actual value being inserted into the database. If the value exceeds the maximum limit of the defined data type, even if the column definition allows it, MySQL will still throw this error.

🛠️ Step-by-Step Verified Fixes

Adjusting Column Definition

  1. Step 1: To resolve this issue, you need to adjust the column definition in your table. You can do this by modifying the `integer(10)` definition to a larger data type, such as `bigint` or `decimal`. For example, if the column is defined as `integer(10)`, you could change it to `bigint 20` to allow for values up to 2^80-1.
  2. Step 2: Alternatively, you can also adjust the actual value being inserted into the database. If possible, find out where the value is coming from and modify it to fit within the defined data type. For example, if the value exceeds the maximum limit of `integer(10)`, you could round it down or use a different data type altogether.
  3. Step 3: Once you have adjusted the column definition or the actual value being inserted, re-run the INSERT statement to verify that the error has been resolved.

Using a Larger Data Type

  1. Step 1: If adjusting the column definition is not feasible, another alternative method is to use a larger data type. In this case, you would need to change the column definition from `integer(10)` to a larger data type such as `bigint` or `decimal`. This will allow for values up to 2^80-1 or more decimal places respectively.
  2. Step 2: When using a larger data type, ensure that you adjust the corresponding data type in your application code as well. For example, if you are using PHP, you would need to change the data type of the variable from `int` to `bigint`. Alternatively, you could use a library or framework that supports arbitrary-precision arithmetic.

🎯 Final Words

In conclusion, MySQL Error 1264: out of range value for column occurs when attempting to insert a value into an integer column that exceeds its maximum limit. To resolve this issue, you can either adjust the column definition to allow larger values or use a larger data type in your application code. By following these steps and adjusting your database schema accordingly, you should be able to successfully insert data into your table without encountering this error.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions