I generate backups of my databases by using mysqldump.exe -u root --all-databases > mariaDbBackup.sql.

When I try to restore my dump by doing mysql -u root -p < mariaDbBackup.sql, I get an

Error 1064 (42000) near 'STATS_PERSISTENT=0'

Here is the faulty line:

CREATE TABLE `engine_cost` (
  `engine_name` varchar(64) NOT NULL,
  `device_type` int(11) NOT NULL,
  `cost_name` varchar(64) NOT NULL,
  `cost_value` float DEFAULT NULL,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `comment` varchar(1024) DEFAULT NULL,
  PRIMARY KEY (`cost_name`,`engine_name`,`device_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0;
/*!40101 SET character_set_client = @saved_cs_client */;

It is the first line out of seven on the backup that includes STATS_PERSISTENT=0 so I assume it might have to be a compatibility issue. I am using specifically MariaDB 10.1.37 and MySQL 5.5.39.

I assume there have to be some flag in either generating or reading the dump that I can use to be able to do it.

So, how can I restore the dump or how do I generate a compatible dump?

有帮助吗?

解决方案

I've not tested this myself, but in the MariaDB mysqldump main page there is a paragraph about the --create-options switch which seems to indicate you can solve the problem by using the switch --skip-create-options:

Include all MariaDB and/or MySQL specific create options in CREATE TABLE statements. Use --skip-create-options to disable.

许可以下: CC-BY-SA归因
不隶属于 dba.stackexchange
scroll top