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:
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
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:

<       if (opt_drop_database)
>       if (opt_drop_database && my_strcasecmp(qdatabase, quote_name("mysql", qbuf, opt_quoted))!=0)
<       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.