silverstripe / sspak

Tool for managing bundles of db/assets from Silverstripe environments
http://silverstripe.github.io/sspak/
BSD 3-Clause "New" or "Revised" License
47 stars 34 forks source link

Unknown table 'COLUMN_STATISTICS' in information_schema (1109) error #81

Closed michalkleiner closed 2 years ago

michalkleiner commented 3 years ago

Getting an error when running sspak with MySQL 5.7.

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

Might be a specific db setting, but passing in --column-statistics=0 to mysqldump fixes the issue. Will provide a PR.

michalkleiner commented 3 years ago

As a workaround we're using a proxy script adding these params, with the same name as the mysqldump binary, in a path that takes priority when searching for the executable. Works ok, so the addition should be ok, too.

#!/bin/sh

/usr/bin/mysqldump --no-tablespaces --column-statistics=0 $@
emteknetnz commented 3 years ago

@michalkleiner is it the same issue as this? https://serverfault.com/a/912677

i.e. you're using a mysql 8 client and accessing a mysql 5.7 database?

michalkleiner commented 3 years ago

Highly likely, @emteknetnz. We don't have access to MySQL settings to change the default in its config neither can install/choose the mysqldump binary version, it's whatever comes with the container (SiteHost Cloud Containers).

A relevant point would be to see what the presence of the switch does when passed to a 5.7 mysqldump binary.

emteknetnz commented 2 years ago

Closing issue as linked PR was merged