Bug #522 Fatal Error after unclean shutdown
Submitted: 28 May 2003 3:40 Modified: 1 Jun 2003 14:09
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:MySQL 4.0.12 OS:Windows (Windows (XP))
Assigned to: CPU Architecture:Any

[28 May 2003 3:40] [ name withheld ]
Description:
MySQL shuts down after a powerdown with the following message:

Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't exist

How to repeat:
1. Install MySQL on a Windows NT platform
2. Grant special privileges
3. Start your MySQL server
4. Disconnect the power
5. Restart your computer

Suggested fix:
The only fix I found was to reinstall MySQL.
[28 May 2003 10:55] Indrek Siitan
Yes, in case of a power loss data corruption is likely to occur, but this cannot be blamed on 
MySQL. This happens because the operating system caches data in memory to speed up things, an 
in case of a power loss the buffers cached in memory won't be written to disc.

To avoid that, you should take regular backups of your data and if something like that occurs, you 
can just restore the last backup.
[1 Jun 2003 14:09] Michael Widenius
Some more information about this.

The error you got is very strange as the mysql.host table is normally never written to and should thus not be able to disappear.
The only reason that I can think of that could explain this are:
- Somehow you or the OS manages to delete the existing host.frm files in the C:\mysql\data\mysql directory
- When you restart mysqld, its starting up in the wrong database directory.
- You have moved the mysqld data directory
- You have modified the my.inf or my.cnf file so that MySQL can't find the database directory.

All the above problems can be solved without reinstalling MySQL by following the instructions in the MySQL manual in the windows section and in
the 'Creating Trace Files' section.
[2 Jun 2003 3:20] [ name withheld ]
I'm sorry that you closed my bug. My E:\mysql\data\mysql dir doesn't exist. So either it never did or it got deleted. I'll try to repeat the unclean shutdown and figure out what goes wrong. If this is a XP problem only, I'd expect this to happen to any program under XP.