MySQL Forums
Forum List  »  Data Recovery

mysqldump creates conditional comments that lead to errors when restoring
Posted by: Jochen Kunze
Date: May 16, 2017 02:25AM

Hello,
I use mysqldump (Ver 10.13 Distrib 5.5.52, for solaris10 (i386)) to make dumps of my wordpress database. When I try to restore the dump with mysqldumper, there are several errors concerning conditional comments, which are inserted in the dump by mysql dump. Something like these:

/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `wp_commentmeta` (
`meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
...
...
KEY `meta_key` (`meta_key`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

or

/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

The error message is "Cannot set <variable_name> to null".

When I remove all these conditional comments the import is no problem and everything is fine.

My questions: Is it save to remove these comments or to force the import in case of SQL errors? Which function do these statements have?

I understand that some variables are stored and after all is done are restored. But Why?

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.