1

I had a heavily corrupted MySQL database, so I tried to restore the files from a recent backup (a local time machine snapshot), but that failed with the error:

The operation can’t be completed because you don’t have permission to access some of the items.

How can I restore these files?

In trying, I added my account to the "_mysql" group with dseditgroup (groups now lists me as being in the "_mysql" group), which is supposed to be granted read/write access to all files and folders, and tried restoring from Time Machine again with the same result. The folders also still display the "inaccessible" icon overlay (⛔️) in Finder. I can copy (slightly) older versions of the files stored on an external Time Machine drive from a shell with a sudo ditto, but get a permissions error from MySQLd when it tries to read one of the files (the binary log index).

The computer is running OS X 10.12.6.

2

I was able to access the local snapshots in "/.MobileBackups/Computer/" via a command line. Unfortunately, I disabled automatic Time Machine backups, not knowing that this would delete all local snapshots.

The files from the external Time Machine backup had an ACL that disallowed all write access to the database directories and files (revealed with ls -le). Removing the ACL with chmod -RN $dir granted access (no more permission errors when MySQLd runs).

  • 1
    I would add you may need to give terminal.app (or whatever app opens your shell) full disk access to get around sandbox file restrictions. That is in System Preferences and will be needed by anyone on Mojave that tries this. Great answer - thanks for posting. – bmike Dec 22 '18 at 16:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .