When the MySQL database is started, the following error occurs:
120419 19:10:32 [ERROR]/usr/local/mysql/libexec/mysqld: Can't find file: './mysql/host. frm' (errno: 13)
120419 19:10:32 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host. frm' (errno: 13)
120419 19:10:32 mysqld_safe mysqld from pid file/web2/mysql/localhost. localdomain. pid ended
The file mysql/host. frm is not found.
Possible reasons are:
1. The file does not exist.
2. The file exists, but the permission is incorrect.
3. The host table is broken.
4. When the disk space is full (mysqld_safe mysqld from pid file/web2/mysql/localhost. localdomain. pid ended), only the system prompts that this error may be related to space or permissions)
However, this file exists, and the permission to view the file is correct, and the disk space is not full.
The host table in the mysql database is broken. Use myisamchk to fix the table.
/Usr/local/mysql/bin/myisamchk-c-m-r-a-o/web2/mysql/host. MYI
This error is still reported, and all the tables in the mysql database are repaired or an error is reported.
With the help of group friends, the database is initialized and restarted with commands. It is normal, but all the data in the database is gone (fear after initialization, I thought that all the data was cleared by me. Fortunately, I used to specify datadir to another directory. Fortunately, after initialization, I used commands. If I used scripts, I would not have to do it anymore, online Database)
Quickly back up mysql under/web2/mysql, copy the mysql that was initialized in the default directory to/web2/mysql, restart the database, and then modify the Database Password and authorization, recovered
The initialization command is still used with caution. This time it is a mistake and you should be cautious when doing things in the future.