Phong Yew Tong
2 min readApr 7, 2020


How to completely remove MYSQL on your localhost?

How to completely remove MYSQL on your localhost?
Photo by Markus Spiske on Unsplash

Sometimes, we thought a simple brew remove mysql will remove the entire MySQL but in some cases, it does not. Here is how you can completely remove MySQL on your mac locally.

  1. Open your terminal.

Shortcut tip: CMD + Space >> type “ter” >> press enter, terminal will popup.

2. Use mysqldump to backup your databases.

mysqldump -h localhost -u userName -p databaseName > sqldump.sql

3. Stop MYSQL from running.

brew services stop mysql

If you have a specific version for MYSQL you can run this.

brew services stop mysql@5.7

4. Remove MYSQL.

brew remove mysql
brew cleanup

5. Remove the remaining MYSQL files.

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*

6. Unload MySQL login:

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

7. Remove MYSQL configuration. You can use nano or vim.

nano /etc/hostconfig

and remove this line below


8. Remove the MYSQL preferences.

rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*

You should have removed all the necessary files by now.

If you still face version or installation errors. You might want to kill the previous MySQL processes using the command below or restart your mac.

Kill the remaining MySQL process.

pkill mysql


pkill mysqld

Check if all MYSQL processes are killed.

ps -ax | grep mysql

or check if the port 3306 is being used by any MYSQL process.

lsof -i :3306



Phong Yew Tong

I will follow you back. Entrepreneurship, React, Flutter, Firebase, Typescript, Javascript, ChatGPT, Crypto. Visit