Home > Database > Mysql Tutorial > MySQL恢复中的几个问题解决方法_MySQL

MySQL恢复中的几个问题解决方法_MySQL

PHP中文网
Release: 2016-05-27 13:45:30
Original
1376 people have browsed it

事情是这样的: 我有个BuyVM的VPS,结果人家机器挂了,然后新开了一个给我,我要求给我导出备份,人家还真抢救出来大部分数据.然后就是一个恢复的过程.Web恢复没有任何难度.问题就出在MySQL的恢复上,记一笔.

1. data目录完整,但是无法读出任意一个表,show tables显示为空.

起先是怀疑data目录有问题,尝试修复,提示不存在表. 经光总提醒说是不是用户组问题.指定用户组为mysql,解决.


代码如下:

chown -R mysql /var/lib/mysql
Copy after login

2.接着修复,出现


代码如下:

warning : Table is marked as crashed and last repair failed
warning : 1 client is using or hasn't closed the table properly
warning : Size of datafile is: 32453700 Should be: 32376944
error : Wrong bytesec: 0-0-0 at linkstart: 32453660
Copy after login

根据提示,是data文件owner问题,一看果然是root,给他mysql,解决.


代码如下:

chown -R mysql.mysql /var/lib/mysql
Copy after login

3.运行完修复,提示有个表Error: Incorrect information in file: ‘./aaa/bbb.frm'.

尝试各种修复方式均未成功.Google了一下,发现.frm存储的只是表结构.表结构?那尝试一下用相同表结构的文件覆盖.删掉bbb.frm,随便复制一个库下的ccc.frm,改名为bbb.frm.一看,搞定!

一句话,多备份才是王道,mysql的磁盘转移总会遇到各种各样问题.

以上就是MySQL恢复中的几个问题解决方法_MySQL的内容,更多相关内容请关注PHP中文网(www.php.cn)!


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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template