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);
}