FriendsOfSulu / SuluImportExportBundle

Simple Import/Export Bundle for Sulu 2 CMS
MIT License
12 stars 5 forks source link

mysqldump COLUMN_STATISTICS error #2

Open sobocinski opened 3 years ago

sobocinski commented 3 years ago

Hi, when I was using sulu:export commnad I have error like this.

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

According to what is written https://serverfault.com/a/912677 This is due to a new flag that is enabled by default in mysqldump 8, adding --column-statistics=0 to mysqldump command fixes the problem.

So maybe a change in exportDatabase() method to:

$command = 
 "mysqldump --column-statistics=0 -h {$this->databaseHost} -u " . escapeshellarg($this->databaseUser) .
            ($this->databasePassword ? ' -p' . escapeshellarg($this->databasePassword) : '') .
            ' ' . escapeshellarg($this->databaseName) . ' > ' . $this->exportDirectory . \DIRECTORY_SEPARATOR . ImportExportDefaultMap::FILENAME_SQL;

will solve problems in future.

TheCadien commented 3 years ago

Thanks @sobocinski . I'll have a look at it, but I think you're right and this could be a good change for the future. Thanks for reporting!