MySQL host table error recovery

Source: Internet
Author: User
Tags mysql host

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.