Bug #64536 mysqldump using --add-drop-database make it error when restore

Submitted: 3 Mar 2012 16:56 Modified: 3 Mar 2012 17:06
Reporter: xiaobin lin (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:5.5 OS:Any
Assigned to: CPU Architecture:Any
Tags: add-drop-database, Contribution, ERROR 1580, mysqldump

[3 Mar 2012 16:56] xiaobin lin
Description:
Just similar with http://bugs.mysql.com/bug.php?id=45740, but the case seems more "strange".

In my normal running mysqld, the "log_slow_queries" is ON.

If I run mysqldump  with --all-databases --add-drop-database
and then run "mysql -e 'source dumpfile'", 

there is an error shows 
   "ERROR 1580 .... You cannot 'DROP' a log table if logging is enabled"

How to repeat:
As above

Suggested fix:
To be simple, avoid generating "drop database mysql",
Or it can be an option like "force-drop-system-database" with default value of 0.
In generally, make the steps above can be used to restore data successfully.
The simple strategy patch for mysqldump.c just as:

4105c4105
<       if (opt_drop_database)
---
>       if (opt_drop_database && my_strcasecmp(qdatabase, quote_name("mysql", qbuf, opt_quoted))!=0)
4115c4115
<       if (opt_drop_database)
---
>       if (opt_drop_database && my_strcasecmp(qdatabase, quote_name("mysql", qbuf, opt_quoted))!=0)
[3 Mar 2012 17:06] Valeriy Kravchuk
Thank you for the problem report.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.070 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
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.