Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours scrolling social media and waste money on things we forget, but won’t spend 30 minutes a day earning certifications that can change our lives.
Master in DevOps, SRE, DevSecOps & MLOps by DevOps School!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Fixing MySQL Error: Incorrect Definition of mysql.column_stats Table

The Problem

While working on your MySQL server, you might come across this error in your error log:

Error:
Incorrect definition of table mysql.column_stats: expected column 'min_value' at position 3 to have type varbinary(255), found type varchar(255).
Incorrect definition of table mysql.column_stats: expected column 'max_value' at position 4 to have type varbinary(255), found type varchar(255).

This error usually shows up after an upgrade or misconfiguration and indicates that MySQL’s internal system table mysql.column_stats has incorrect column types.


Root Cause

The columns min_value and max_value in the mysql.column_stats table are expected to have the type:

varbinary(255)

But due to an unexpected change (often during manual migration or import), they are set to:

varchar(255)

These fields store binary data (like histogram stats), so having them as varchar is not valid for MySQL’s internal use.


How to Fix It Manually via phpMyAdmin

  1. Login to phpMyAdmin
    Go to your MySQL instance and navigate to the mysql database.
  2. Open the column_stats Table
    Go to the Structure tab.
  3. Locate the Problematic Columns
    • min_value (currently varchar(255))
    • max_value (currently varchar(255))
  4. Click “Change” on Each Column
    • Change Type from varchar(255) to varbinary(255)
    • Keep all other settings the same (Null allowed, no default value)
  5. Save the Changes

Final Result

Once corrected, your column types should look like this:

FieldType
min_valuevarbinary(255)
max_valuevarbinary(255)

After saving the changes, you should no longer see the error in your MySQL error log.


Restart MySQL and Run Upgrade

To make sure everything is fully synchronized:

sudo systemctl restart mysql
sudo mysql_upgrade -u root -p

This ensures that MySQL validates all system tables and updates metadata if needed.


Verify It’s Fixed

Run this SQL command to confirm that column_stats is valid:

CHECK TABLE mysql.column_stats;

Related Posts

How to Generate a GitHub OAuth Token with Read/Write Permissions for Private Repositories

When working with GitHub, you may need to interact with private repositories. For that, GitHub uses OAuth tokens to authenticate and authorize your access to these repositories….

Laravel Error: Target class [DatabaseSeeder] does not exist – Solved for Laravel 10+

If you’re working with Laravel 10+ and run into the frustrating error: …you’re not alone. This is a common issue developers face, especially when upgrading from older…

JWT (JSON Web Token) vs OAuth 2.0

Both JWT and OAuth 2.0 are used for managing authentication and authorization, but they serve different purposes and work in distinct ways. 1. Purpose: 2. Role: 3….

Exploring and Creating a Proof of Concept (POC) to Upload APK Directly from GitHub Package

Automating the process of uploading an APK (or AAB) to the Google Play Store from GitHub can significantly speed up your CI/CD pipeline. By integrating Google Play’s…

A Detailed Guide to CI/CD with GitHub Actions

Continuous Integration (CI) and Continuous Deployment (CD) are modern software development practices that automate the process of integrating code changes, running tests, and deploying applications. With the…

Step-by-Step Guide for Setting Up Internal Testing in Google Play Console

1. Understanding the Types of Testing Before uploading your Android app for internal testing, it’s essential to know the differences between the testing options available in Google…

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x