
It can be a pain to remove MySQL if you are running Mac OS X Snow Leopard on a machine. A while ago, I had downloaded the for MySQL DMG from mysql.org, mounted it, installed the database server, installed the startup item, and installed the panel for System Preferences.
We have been installing Ubuntu 10.04 server edition for our client dedicated servers and VPSs since it came out. Ubuntu 10.04 Server is going to be supported with minor bug fixes and security updates for 5 years, so its a great platform for building web applications. So I wanted to update the MySQL version running on my development machine closer to the MySQL running on Ubuntu 10.04.
Then I was reminded of a nasty problem that is all too common unfortunately. A lot of open source tools that have installers for Mac OS X, don’t having corresponding uninstallers. I can understand why open source developers aren’t keen on spending time to do so. Most of them are using a Linux distribution to write code, and they already have package managers (either YUM for Red Hat/Fedora or APT for Debian/Ubuntu). If you use a package manager to install an application, it can be used to uninstall easily as well.
It takes a few steps to remove MySQL off Snow Leopord. If any of this breaks your system, don’t blame me, the following process on my machine.
First, use mysqldump to backup all the databases you want to keep.
Second, stop the database. There are a couple ways of doing this. If you installed the MySQL preferences panel, you can go in there and shutdown the server. Otherwise, “sudo mysqladmin shutdown”.
Next, lets remove the MySQL binary and configuration files:
- sudo rm /usr/local/mysql
- sudo rm -rf /usr/local/mysql*
If you installed the service to startup MySQL automatically at boot and the System Preferences panel, lets remove them:
- sudo rm -rf /Library/StartupItems/MySQLCOM
- sudo rm -rf /Library/PreferencePanes/My*
- rm -rf ~/Library/PreferencePanes/My*
OS X keeps track of installed applications by tracking “receipts”. There are several places we need to delete references to MySQL. First:
- sudo rm -rf /Library/Receipts/mysql*
- sudo rm -rf /Library/Receipts/MySQL*
Next, we are going to look for receipts in a different location. Open up /Library/Receipts/InstallHistory.plist, find the entry for MySQL, delete the entry.
One more location: look in /private/var/db/receipts/ and search for mysql in the directory. There should be 2 files, delete them.
You are done.










