Bug #55702 'DROP DATABASE mysql' display weired warnings.
Submitted: 3 Aug 2010 5:58 Modified: 3 Aug 2010 6:22
Reporter: Meiji KIMURA Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:5.1.x OS:Any
Assigned to: CPU Architecture:Any

[3 Aug 2010 5:58] Meiji KIMURA
Description:
When dropping mysql database, you'll see weired warnings. At that time mysql.proc and mysql.event exists.

mysql> drop database mysql;
Query OK, 0 rows affected, 2 warnings (8 min 11.25 sec)

mysql> drop database mysql;
Query OK, 23 rows affected, 2 warnings (5.41 sec)

mysql> show warnings;
+-------+------+-----------------------------------+
| Level | Code | Message                           |
+-------+------+-----------------------------------+
| Error | 1146 | Table 'mysql.proc' doesn't exist  |
| Error | 1146 | Table 'mysql.event' doesn't exist |
+-------+------+-----------------------------------+
2 rows in set (0.00 sec)

How to repeat:
Install rpm package, and run mysql client to issue this command.

mysql> drop database mysql;

Suggested fix:
[Workaroud]

Ignore these messages.

[Suggested fix]

I trance this behavior with gdb under MySQL 5.1.47.
Deleting table on mysql works well, but in mysql_rm_db(sql_db.cc) there are problems. After all deleting done, mysql try to use mysql.proc, mysql.evnet at 
sp_drop_db_routines(), Events::drop_schema_events(). Thus they makes the weired messages. So we should skip these procedures when mysql database dropping.

    if ((deleted= mysql_rm_known_files(thd, dirp, db, path, 0,
                                       &dropped_tables)) >= 0)
    {
      ha_drop_database(path);
      tmp_disable_binlog(thd);
      query_cache_invalidate1(db);
      (void) sp_drop_db_routines(thd, db); /* @todo Do not ignore errors */
#ifdef HAVE_EVENT_SCHEDULER
      Events::drop_schema_events(thd, db);
#endif
      error = 0;
      reenable_binlog(thd);
    }
[3 Aug 2010 6:22] Konstantin Osipov
Don't do that.
[11 Aug 2010 5:22] Meiji KIMURA
Backup 'mysql' database using mysqldump with '--add-drop-database' cause these warning. 

In this case, I have to either ignore the warnings, or remove --add-drop-database from the switch.