Change mysql db location when installed with homebrew using Big Sur and external hard drive

384 views Asked by At

Previously I had /usr/local/var/mysql symlinked to /Volumes/External/mysql meaning all my databases were stored on the external hard drive.

I have had to reformat my machine and upgrade to BigSur. If I try to set up the symlink as before I now get the following when I try to start MySQL

brew services start mysql
Bootstrap failed: 5: Input/output error
Error: Failure while executing; `/bin/launchctl bootstrap gui/502 /Users/jamie/Library/LaunchAgents/homebrew.mxcl.mysql.plist` exited with 5. 

If I try to also change the -datadir in

 /usr/local/Cellar/mysql/8.0.26/homebrew.mxcl.mysql.plist

to be

<string>--datadir=/Volumes/External/mysql</string>

I get the same error

brew services start mysql
Bootstrap failed: 5: Input/output error
Error: Failure while executing; `/bin/launchctl bootstrap gui/502 /Users/jamie/Library/LaunchAgents/homebrew.mxcl.mysql.plist` exited with 5.

I have tried

launchctl unload /Users/jamie/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl load /Users/jamie/Library/LaunchAgents/homebrew.mxcl.mysql.plist

but that didn't work either. It's like it doesn't have the correct permissions. Looking at the privacy settings you can see httpd which is also installed by brew is allowed to see "Removable volumes".

enter image description here

I can't add MySQL as the + symbol is grey out even though I have unlocked the panel

The external hard drive is located at /Volumes/External/ and is APFS (Encrypted) volume.

Any help would be much appreciated

1

There are 1 answers

0
goose84 On BEST ANSWER

https://github.com/Homebrew/discussions/discussions/2092#discussioncomment-1286031

Select System Preferences->Security & Privacy->Full Disk Access Click the lock to make changes Click '+' Press 'cmd + Shift + .' to show hidden files select /bin/sh