Fixing MySQL issues on macOS

Vijay N
Vijay N
Dec 27, 2019 · 2 min read
Image for post
Image for post

Recently faced some issues with MySQL after a macOS update, though it was running perfectly on the old version.

The main issues

ps -ax | grep mysql

and it didn’t give any trace saying that MySQL is running.

  • Even if we manually stop/start from the preference pane, nothing was really happening, means MySQL was not working for me
  • If you’re also going through the same I request to do a fresh installation of MySQL by following the below mentioned Steps.

Solution for the Pain

ps -ax | grep mysql
  • If found kill it using
kill -9 {PID} 

or using launchctl

sudo launchctl unload -w /Library/LaunchDaemon/com.mysql.mysql.plist
  • I suppose you’re familiar with HomeBrew , if so give the command
 brew remove mysql
  • Then issue the command
brew cleanup
  • Then find for MySQL traces in your system by issuing the command
sudo find / | grep -i mysql 

it will return a long list and use rm command to remove the significant.( Assuming you’ve the knowledge of the system)

  • Then delete the files one by one using rm command i.e
rm /usr/local/mysql*sudo rm -rf /usr/local/var/mysql*sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  • Even if you uninstall MySQL using Homebrew, the preference pane will be there so in-order to remove that issue the below commands.

Be careful using these commands

sudo rm ~/Library/PreferencePanes/My* sudo rm -rf /Library/Receipts/mysql*sudo rm -rf /private/var/db/receipts/mysql*
  • The above gonna fix all the existing issues now you need to use brew again, and check whether brew is updated by giving brew update command
  • Then you can install the latest MySQL again by brew install mysql and follow the instructions on terminal.
  • After that you can start mysql server using any one of the below commands
brew services start mysql mysql.server start
  • Verify it by using the command
ps -ax | grep mysql

Note: here you won’t be getting that icon on the preference pane again but there are workarounds to achieve that as well

Internet Mango

Stories on technology, code and happiness at Internet Mango

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store