Forums

mysqldump Error: : Unknown table 'COLUMN_STATISTICS' in information_schema (1109)

I'm trying to dump my MySQL database using the command:

mysqldump -u USERNAME -h USERNAME.mysql.pythonanywhere-services.com --set-gtid-purged=OFF --no-tablespaces 'USERNAME$sm17' | xz -c > db_backup_29Mar2022b.sql.xz

(with my username replacing the 'USERNAME') similar to the instructions here: https://help.pythonanywhere.com/pages/MySQLBackupRestore/

This had worked okay in the past, but today gives the error:

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

Sorry, I've added the "--column-statistics=0" parameter to that mysqldump command and it works okay now. I just realised that mysqldump is at a newer version 8, so needs that parameter as explained on that help page.

mysqldump --version
mysqldump  Ver 8.0.25-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))

If you're using our most recent system image, you'll need an extra flag on that command line: --column-statistics=0 -- see the second example on our help page.