Brew services list shows mysql in the "error" state, but mysql is running correctly

When I start mysql with brew services start mysql the mysqld process is started correctly, and I can connect with mysql -uroot -p, but brew services show “error” for mysql.

Even though MySQL is running correctly, it seems to me something must be off. Is there something I can do to fix this?

launchctl output seems okay:

$ launchctl list | grep mysql
89005	1	homebrew.mxcl.mysql

In /var/log/system.log I do see some strange entries when running brew services restart mysql:

com.apple.xpc.launchd[1] (homebrew.mxcl.mysql[88489]): Service did not exit 5 seconds after SIGTERM. Sending SIGKILL.
com.apple.xpc.launchd[1] (homebrew.mxcl.mysql): This service is defined to be constantly running and is inherently inefficient.
com.apple.xpc.launchd[1] (homebrew.mxcl.mysql[88909]): Service exited with abnormal code: 1
com.apple.xpc.launchd[1] (homebrew.mxcl.mysql): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

I’ve run brew update and brew doctor shows no issues.

Exactly same behaviour here for mysql@5.7:

$ launchctl list | grep mysql
22762	1	homebrew.mxcl.mysql@5.7

Did anyone resolve this problem? I am having a similar issue. brew services list shows mysql in an error state. However, I can create a session with mysql in terminal and execute queries in a database of my choosing so I do not know what’s wrong exactly. Also, my wordpress all of a sudden is complaining about an “Error establishing a database connection”.

Following the instructions here I ran these commands to see if mysql’s running state would improve:

$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
/Users/robskrob/Library/LaunchAgents/homebrew.mxcl.mysql.plist: Operation now in progress
$  launchctl remove ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

As a result when I run brew services list I now see mysql in a better status – mysql went from error to started and has stayed at started: mysql started robskrob /Users/robskrob/Library/LaunchAgents/homebrew.mxcl.mysql.plist`

However, wordpress still cannot make a connection to mysql.

That’s probably just the authentication method you’re using for mysql 8. Google the error.

@SMillerDev google what error specifically? Are you suggesting that I google the error that wordpress is showing me in my browser, or are you suggesting that I google the error in my System log?

For your information, I had to downgrade my MySQL version to 5.7 as explained here.

Googling the wordpress error will tell you that the system is set up for an authentication method only available in mysql 8. You probably missed some steps in the guide, try and see what version the server shows with SHOW VARIABLES LIKE “%version%”;