I installed mysql@5.7 using brew. After installing, I started the service using brew services start mysql@5.7
. Checking using brew services
shows its working fine.
In any attempt after the first though, the behavior is different. I run brew services start mysql@5.7
and I get:
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/505 /Users/Mahmoud/Library/LaunchAgents/homebrew.mxcl.mysql@5.7.plist` exited with 5.
If I then try to restart the service, using brew services restart mysql@5.7
I get
Stopping `mysql@5.7`... (might take a while)
==> Successfully stopped `mysql@5.7` (label: homebrew.mxcl.mysql@5.7)
==> Successfully started `mysql@5.7` (label: homebrew.mxcl.mysql@5.7)
but an inspection using brew services
would show that the service has been stopped:
Name Status User File
mysql@5.7 stopped root ~/Library/LaunchAgents/homebrew.mxcl.mysql@5.7.plist
Stopping the service manually using brew services stop mysql@5.7
and starting again hasn't worked as well.
Tried as well to uninstall using brew uninstall mysql@5.7
and re-installing using brew install mysql@5.7
but the problem persists. I tried looking all around but I don't see anyone having this same problem. Any ideas on how to fix this?
Environment: M1 MPB, OSX 12.4
Spent a full day on this and finally came to a solution that worked.
Stop the service with brew services stop mysql@5.7
Remove the launch agent file rm ~/Library/LaunchAgents/homebrew.mxcl.mysql@5.7.plist
Unlink the service if it was linked brew unlink mysql@5.7
Uninstall the service brew uninstall mysql@5.7
Then I removed the mysql data directory, suggested above. This wasn't in the /usr/local/var/mysql
on my machine, but rather /opt/homebrew/var/mysql
So rm -rf /opt/homebrew/var/mysql
This wasn't the last step for me. Reinstalling at this point gave me a bunch of errors and the brew post install steps failed. Most of the errors pointed to my my.cnf
file. I found that removing this file before attempting to reinstall prevented those errors.
I made a backup of this file just in case this caused more issues.
cp /opt/homebrew/etc/my.cnf /opt/homebrew/etc/my.cnf.backup
Then, rm /opt/homebrew/etc/my.cnf
Note: this file may be in a different location on your machine.
Ok, now do a fresh install.
brew install mysql@5.7
brew link mysql@5.7 --force
If you link the package, you can add it to your path following the brew log suggestion. So add, export PATH="/opt/homebrew/opt/mysql@5.7/bin:$PATH"
to your ~/.zshrc
.
Verify the service is available with brew services list
or brew services
.
If you see mysql@5.7 there, go ahead and start it with brew services start mysql@5.7