Showing posts with label OS X 10.5. Show all posts
Showing posts with label OS X 10.5. Show all posts

May 20, 2010

Uninstall MySQL on Mac OS X (Leopard 10.5 or Snow Leopard 10.6)

Problem

You need to completely remove mysql from your system as easily as possible.

Symptoms

You want to do a clean delete and a fresh install because you don't want to deal with errors such as:
  • MySQL [your version] for Mac OS X can't be installed in this disk. A newer version of this software already exists on this disk.
  • [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
  • [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

Solution

Execute the following commands that I found here and here:
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
Maybe one day, if I'm feeling frisky, I'll come back and write a bash script to remove the MYSQLCOM line auto-magically. Maybe some magic involving sid or awk or something.