MySQL, copying tables files gives rise to “ERROR 1017 (HY000): Can't find file:” even though its there there

前端 未结 7 2212
时光说笑
时光说笑 2020-12-14 04:41

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.

I stopped mysql and deleted

相关标签:
7条回答
  • 2020-12-14 04:42

    I did have the very same issue a couple minutes ago and it took me a few minutes to realize that I had insufficient permission to access the .sql file I wanted to import.

    In order to get rid of this problem you could just move the file to a place you know you have access to (with your current user) for sure. (eg. ~/Home_directory).

    I hope I could help some lonely soul that was searching for the answer just like I was.

    0 讨论(0)
  • 2020-12-14 04:43

    I changed permissions for the mysql-data-directory as well as the <table>.frm file.
    If using as root user:

    • chmod 600 mysql-data-directory chmod 600
    • mysql-data-directory/tableOfData.frm

    If using as non-root user:

    • chmod 660 mysql-data-directory
    • chmod 660 mysql-data-directory/tableOfData.frm
    0 讨论(0)
  • 2020-12-14 04:49

    I encountered the same issue after restoring a MySQL database with frm and MYD files. After a number of hours spent I observed that I have configured the database directory with only read and write permission to mysql user but not execute permission. After adding execute permission to the database directory, the problem was solved.

    0 讨论(0)
  • 2020-12-14 04:49

    I had the same issue and did this...

    • Delete Migrations Folder
    • Drop the _migrationhistory table
    • Enable, Add and Update migration

    I'm sure there's a much better way to solve this but, it worked for me.

    0 讨论(0)
  • I'd suggest giving two things a try:

    1. Check Permissions

    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. Repair corrupted tables

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

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

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

    0 讨论(0)
  • 2020-12-14 05:04

    This error, "General error: 1017 Can't find file", also happened on Windows with WAMP if the table doesn't exist.

    0 讨论(0)
提交回复
热议问题