MySQL,复制表格文件会引起“错误1017(HY000):找不到文件:"即使在那里 [英] MySQL, copying tables files gives rise to "ERROR 1017 (HY000): Can't find file:" even though its there there

查看:98
本文介绍了MySQL,复制表格文件会引起“错误1017(HY000):找不到文件:"即使在那里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将数据库表从生产服务器复制到本地测试机,以便可以对真实数据进行om测试(复制).

I want to copy the database tables from my production server to a local test machine so I can perform test om (copies of) the real data.

我停止了mysql,并删除了所有的frm,MYD和MYI文件.在这里启动mysql并查询show table会得到一个空的结果集.然后,我关闭mysql,并从服务器复制了所有的frm,MYD和MYI文件.当启动mysql时,显示表"显示了预期的表,但是尝试查询它们时,我得到了错误消息

I stopped mysql and deleted all the frm, MYD and MYI files. Starting mysql here and querying show tables gives an empty result set. I then shut down mysql and copied all the frm, MYD and MYI files from the server. When starting mysql "show tables" shows the tables as expected but trying to query them I get the error message

错误1017(HY000):找不到文件:"./WhateverTableIQuery.frm" (errno:13)

ERROR 1017 (HY000): Can't find file: './WhateverTableIQuery.frm' (errno: 13)

但是WhateverTableIQuery.frm文件位于光盘上,与服务器上的文件相同.

But the WhateverTableIQuery.frm file is on the disc and is identical to the one on the server.

关于可能是什么问题的任何想法?

Any ideas about what might be the problem?

推荐答案

我建议尝试两件事:

1.检查权限

确保您的MySQL数据目录及其中的所有文件均由mysql用户和mysql组拥有.如果您以root用户的身份将文件复制到本地测试计算机上,则可能不是这种情况:

Make sure that your MySQL data directory and all the files in it are owned by mysql user and mysql group. This may not be the case if you copied the files onto your local test machine as root user:

chown -R mysql:mysql your-mysql-data-dir-here

2.修复损坏的表

使用 mysqlcheck 检查损坏的表并进行修复如果找到的话:

Use mysqlcheck to check for corrupted tables and repair them if it finds any:

mysqlcheck -u root -p --auto-repair --all-databases

如果在那之后您仍然不能使用表,那么请给mysqldump一个机会!

If you still can't use the tables after that then give mysqldump a go!

这篇关于MySQL,复制表格文件会引起“错误1017(HY000):找不到文件:"即使在那里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆