Fixing “Unknown table ‘COLUMN_STATISTICS’ in information_schema” Error in MySQL 5.7 When Using mysqldump from MySQL 8.0 Client


3 views

When attempting to perform a database dump using mysqldump from a MySQL 8.0 client to a MySQL 5.7 server, you encounter this frustrating error:

mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM,
'$."number-of-buckets-specified"') FROM
information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = 'db' AND
TABLE_NAME = 'Absence';':
Unknown table 'COLUMN_STATISTICS' in information_schema (1109)

The root cause is a version mismatch between client and server. MySQL 8.0's mysqldump tries to access the COLUMN_STATISTICS table in information_schema, which was introduced in MySQL 8.0 for histogram statistics. However, this table doesn't exist in MySQL 5.7.

Here are three effective ways to resolve this issue:

1. The Recommended Solution

Add --column-statistics=0 to your mysqldump command:

mysqldump --column-statistics=0 --single-transaction --host host -u user -p db > db.sql

This explicitly tells the client not to attempt accessing the non-existent table.

2. Alternative: Downgrade Your Client

If you have control over the client machine, install a MySQL 5.7 version of mysqldump:

# On Ubuntu/Debian
sudo apt-get install mysql-client-5.7

# Verify version
mysqldump --version

3. Configuration File Solution

Add this to your ~/.my.cnf file:

[mysqldump]
column-statistics=0

After applying any of these fixes, verify the dump completes successfully:

mysqldump --column-statistics=0 --host host -u user -p db | head -n 20

This will show the first 20 lines of the dump output without running the full operation.

If you've already generated incomplete dumps due to this error:

  • The dump file might be missing some table data
  • Always verify the dump's integrity before relying on it
  • Consider adding --verbose to see progress during the dump

If you can't upgrade the server to MySQL 8.0, these workarounds will serve you well. The most maintainable solution is using the --column-statistics=0 flag, as it:

  • Requires no server changes
  • Works consistently across environments
  • Minimizes future compatibility issues

If you're running mysqldump from MySQL 8.0 client against a MySQL 5.7 server and seeing this error:

mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM,
'$."number-of-buckets-specified"') FROM
information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = 'db' AND
TABLE_NAME = 'Absence';':
Unknown table 'COLUMN_STATISTICS' in information_schema (1109)

You're not alone. This is a common compatibility issue when newer client tools interact with older server versions.

MySQL 8.0 introduced histogram statistics stored in the COLUMN_STATISTICS table of information_schema. When mysqldump 8.0 tries to access this metadata on a MySQL 5.7 server (which doesn't have this feature), the operation fails.

The simplest solution is to add the --column-statistics=0 flag to your mysqldump command:

mysqldump --column-statistics=0 --single-transaction --host host -u user -p db > db.sql

If you frequently encounter this issue, add this to your MySQL client configuration file (~/.my.cnf or /etc/my.cnf):

[mysqldump]
column-statistics=0

If possible, use a MySQL 5.7 version of mysqldump when working with MySQL 5.7 servers:

mysql-client-5.7 mysqldump --single-transaction --host host -u user -p db > db.sql

After applying the fix, verify your dump completes successfully:

mysqldump --column-statistics=0 --host host -u user -p db | head -n 20

This should show the first 20 lines of your SQL dump without any errors.

Disabling column statistics doesn't affect the actual data being dumped - it only skips some metadata collection that's used by the MySQL optimizer. Your backups will remain complete and valid.

If you can't upgrade your MySQL 5.7 server but need to use mysqldump 8.0, this workaround is safe and reliable. Many production environments maintain this configuration for compatibility.