Home > Database > Mysql Tutorial > body text

MySQL host表错误恢复

WBOY
Release: 2016-06-07 17:13:15
Original
1017 people have browsed it

MySQL数据库启动的时候,出现如下错误:那应该是mysql库里面的host表坏了,用myisamchk修复表/usr/local/mysql/bin/myisamchk -c

MySQL数据库启动的时候,出现如下错误:
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

提示找不到文件mysql/host.frm
可能的原因是:
1、文件真的不存在
2、文件存在,但是权限不对
3、host表坏了
4、磁盘空间满了(mysqld_safe mysqld from pid file /web2/mysql/localhost.localdomain.pid ended,只提示这个错可能和空间或者权限有关)

但是这个文件是存在的,查看文件的权限也是正确的,磁盘空间也没满

那应该是mysql库里面的host表坏了,用myisamchk修复表
/usr/local/mysql/bin/myisamchk -c -m -r -a -o /web2/mysql/mysql/host.MYI
依然是报这个错,把mysql库下面的所有表都修复了,还是报错

在群友的帮助下,初始化了数据库,,再用命令重新启动,正常了,但是里面的数据全部没有了(初始化了之后才害怕,以为所有数据都被我清除了,幸好之前是指定datadir到了其他的目录,又幸好初始化之后是用命令起来的,如果用脚本,估计我就不用干了,线上数据库啊)

赶紧把/web2/mysql下面的mysql备份,把刚才初始化在默认目录下生成的mysql复制到/web2/mysql下面,重启数据库,再重新修改数据库的密码和授权,恢复了

初始化的命令还是慎用,这一次是误打误着,以后做事还是得小心谨慎一些

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template