macOS

Uninstall MySQL database on macOS

  • dani

dani

If you manually installed MySQL on your Mac using the distributable from the MySQL website, not Homebrew, then you need to uninstall MySQL by deleting its files manually.

First of all, backup your databases (or at least the databases you want to keep) by exporting the data into text files with the tool mysqldump. Then stop the MySQL server. Now you can delete the following files from Terminal:

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
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*

Finally, edit the file /etc/hostconfig and remove the line

MYSQLCOM=-YES-