Introduction
I develop on a Mac. I was stuck because I couldn’t kill the MySQL port, and as a result the server wasn’t behaving correctly.
While searching online for a solution, I found an article titled Fixing the zombie mode where MySQL installed via Homebrew on Mac automatically restarts and revives even after you stop it.
I changed the MySQL config as described in that article and restarted my Mac, and it seemed fixed.
Or so I thought, but it wasn’t actually fixed, so I dove back into the sea of the internet.
I’m sure the MySQL port problem has been written about countless times, but…
1. Try changing the MySQL config
Let’s try what the earlier article describes.
My MySQL version was 8.0, so I’ll go with the 8.0 assumption.
First, find the config file.
In my case it was here: ~/Library/LaunchAgents/homebrew.mxcl.mysql@8.0.plist.
Open this file with Vim, VSCode, or whatever, and edit it like this.
<dict>
<key>KeepAlive</key>
<false/> <- from true to false
2. Just restart
3. Fixed… huh? Not fixed!?
4. Something’s off
It looked fixed but wasn’t completely fixed, so I put an end to it with the following command.
I don’t think the solution in (1.) was pointless.
$ mysql.server stop
Stopping the MySQL service with this released the port.