Reputation: 2509
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?
Upvotes: 18
Views: 45913
Reputation: 1
For the Mac M1, while deleting /opt/homebrew/var/mysql
works, it's not recommended as it would result in data loss. As an experienced user, I checked the error logs (located at /opt/homebrew/var/mysql
) and found it was a MySQL version compatibility issue. The error message stated: [ERROR] [MY-014060] [Server] Invalid MySQL server upgrade: Cannot upgrade from 80300 to 90200. Upgrade to next major version is only allowed from the last LTS release, which version 80300 is not.
Although it's unclear when or how MySQL was updated, I resolved the issue by installing the older version using brew install [email protected]
, which restored normal functionality.
Upvotes: 0
Reputation: 21
The answer from jaqarrick is a lifesaver!
Some additional remarks:
The difference between the locations /usr/local/var/mysql
and /opt/homebrew/var/mysql
is due to the arm64 processor. Every Silicon M1-Mx machine has this path for its Homebrew: /opt/homebrew/var/mysql
.
In my case, it wasn't the mysql
service, but mariadb
(without version), but the solution is the same.
I haven't figured out why this breaks every now and then. But with a good backup plan for your databases and this solution, you can fix it in 15 minutes.
Upvotes: 2
Reputation: 666
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]
Upvotes: 63
Reputation: 2509
Here's a key problem that I later discovered with my brew.
As brew services
shows above, the user is root, not the current user.
This is insanely problematic and was the main cause of this problem. The solution to this was:
sudo su
brew services
you should find the services taht are owned by rootbrew stop [email protected]
brew uninstall [email protected]
Those basically uninstall [email protected] for the root userexit
to get back to the user.brew install [email protected]
Now the owner of the service is the current user, and say goodbye to the crazy behavior of brew
Upvotes: 0
Reputation: 61
I had this same issue today and noticed I already had data in the /usr/local/var/mysql/
directory, probably from a previous install.
I didn't care about losing anything within the directory so I removed it all rm -rf /usr/local/var/mysql
and ran brew uninstall [email protected]
and brew install [email protected]
.
When I next checked brew services list
it was already running, something that didn't happen before and it was all working.
Upvotes: 6