Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

brew start and brew restart wont start service

I installed [email protected] using brew. After installing, I started the service using brew services start [email protected]. Checking using brew services shows its working fine.

In any attempt after the first though, the behavior is different. I run brew services start [email protected] 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/[email protected]` exited with 5.

If I then try to restart the service, using brew services restart [email protected] I get

Stopping `[email protected]`... (might take a while)
==> Successfully stopped `[email protected]` (label: [email protected])
==> Successfully started `[email protected]` (label: [email protected])

but an inspection using brew services would show that the service has been stopped:

Name      Status  User File
[email protected] stopped root ~/Library/LaunchAgents/[email protected]

Stopping the service manually using brew services stop [email protected] and starting again hasn't worked as well.

Tried as well to uninstall using brew uninstall [email protected] and re-installing using brew install [email protected] 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?

like image 234
mrateb Avatar asked Dec 01 '25 03:12

mrateb


1 Answers

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 [email protected]

Remove the launch agent file rm ~/Library/LaunchAgents/[email protected]

Unlink the service if it was linked brew unlink [email protected]

Uninstall the service brew uninstall [email protected]

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 [email protected]

brew link [email protected] --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/[email protected]/bin:$PATH" to your ~/.zshrc.

Verify the service is available with brew services list or brew services.

If you see [email protected] there, go ahead and start it with brew services start [email protected]

like image 110
jaqarrick Avatar answered Dec 02 '25 21:12

jaqarrick