Did this blog help you solve a problem? Tip me with Bitcoins at: 17dQktcAmU4urXz7tGk2sbuiCqykm3WLs6

Tuesday, August 18, 2009

Uninstall MySQL on Mac OS X

Using MySQL and Java? Check out an easier way: Yank

Uninstalling MySQL on Mac OS X is very easy - you just have to delete some files. Here you will find instructions to delete both MySQL and the MySQL Startup Item, which you may have installed following the instructions found here: Install MySQL on Mac OS X. Be aware that doing this will delete all your MySQL databases and data.

Step 1: Uninstall MySQL. Fire up the Terminal and type in: cd /usr/local , hit enter, type in: ls , hit enter, and verify that there are two items called "mysql" and "mysql-5.1.37-osx10.5-x86_64" (or similar). These are the two items you want to delete. Type in: sudo rm mysql , hit enter, type in: sudo rm -rf mysql-5.1.37-osx10.5-x86_64 , and hit enter. You'll need to enter your password at some point when prompted.

Step 2: Uninstall the MySQL Startup Item. In Termainl type in: cd /Library/StartupItems , hit enter, type in: ls , hit enter, and verify that there is an item called "MySQLCOM". This is the item you want to delete. Type in: sudo rm -rf MySQLCOM , and hit enter. You'll need to enter your password at some point when prompted.

Piece of cake!!

See also: Install MySQL on Mac OS X
And also: Installing and Running Tomcat on Mac OS X
And also: Set MySQL Server System Variables on Mac OS X
And also: My Mac OS X MySQL Cheat Sheet


warrior said...

I tried to install mysql on my mac os x as u showed, but I get "mysql command not found" error when I type mysql in the bin path.

my mysql is up and running as shown by prefpane in system preferences

Tim Molter said...

@warrior I know what the problem is. If you "cd" to "/usr/local/mysql/bin/" and run "mysql -u root -p", you get that error message. Instead just type at the command line: "/usr/local/mysql/bin/mysql -u root -p" and that will work. Why that is, I have no idea.

By the way, where do you see MySQL running in the system preferences? I can't find it anywhere in there?

Anonymous said...

Thank you for this post. Very Useful! It was much easier than I thought to remove mySQL from my system. Seems that the folks that write the documentation for mySQL don't think that there will ever be a need to remove their program. Thanks Again!

Tim Molter said...

@anonymous, glad it was helpful, thanks for stopping by!

Anonymous said...

Thanks Thanks Thanks !!!
Never thought it was that easy, now I will try to install it again from scratch.

cindyloo said...

I tried this on my macbook pro laptop [OS 10.5.9] and while the rm command seemed to execute properly in su mode, the files are still there - as seen when I run a locate mysql.. I wanted to uninstall b/c no matter what i did, I got a mysql.sock not found.
Am hoping I can run the MAMP install and have it work.

Tim Molter said...

cindyloo, that's strange. Sorry, I can't help with the matter... :(

Anonymous said...

Hi Tim
A short message from the Netherlands.
Your short manual for removing MySQL is (was) great.
I succeeded to remove the MySQL stuff.
Thanks a lot.

Greetings, Hans

Happy said...

Hello Thanks for ur post! =)

Michael Mullin said...

I was able to remove mysql and mysql-5.1...etc.
I needed my password for the first mysql. But when I tried to remove StartupItems/MYSQLCOM, I receive message "permission denied".
Sure hope you can help.
Thanks, Michael

Tim Molter said...

Hans and Happy, glad it help you out! Thanks for the comment.

Michael, It sounds like a user permission issue to me, even though I can't be sure without actually being right there and seeing it. Are you sure you're using sudo before the rm command?

James said...

I followed your instructions and the uninstall worked just great. When I try to install MySql 5.1.50-community for Max OS X it states MySQL 5.1.50-community for Mac OS X can't be installed on this disk. A newer version of this software already exists on this disk'. Help!

Tim Molter said...

Hi James, Sorry, I don't know how to advise you. Other than restarting your computer after the uninstall and retrying, I would post your problem to a MySQL forum somewhere. Good luck.

Anonymous said...

remove the receipts from here-

sudo rm -rf /var/db/receipts/com.mysql.*

you will be free to install any other version,



Anonymous said...

Thanx.. I managed to remove everything you mentioned and also change the line in the hostconfig.
I had a problem that my sql server did not want to start so I installed a 64 bit version. That version did not want to start either. So I removed this version with your example but now a new installer of a 32bit version gives me the message that a newer version of this software already exists on the disk. Nothing is left anymore on my system so do you have an idea why I cannot install a 32 bit version anymore?

Anonymous said...

Thanx everybody with the help also of anonymous I can reinstall again.

GopiMano said...

Thank you..!! it worked.. Your blog is very useful for MAC kidies expecting a lot from you

Anonymous said...

Very helpful post. I've been trying to remove MySQL and you are the first to actually help. Thank you so much!!!

Anonymous said...

when I execute your "Step 1: Uninstall MySQL. Fire up the Terminal and type in: cd /usr/local , hit enter, type in: ls , hit enter, and verify that there are two items called "mysql" and "mysql-5.1.37-osx10.5-x86_64" (or similar)." I don't see the two files, I just see this:

bin include lib share

Can you help me? Thank you,

Tim Molter said...

@anonymous It looks like you might have cd'd to /usr/ and not /usr/local/. You can verify which directory you're in by using the "pwd" command. If, after typing in "pwd", you are indeed in /usr/local/ and you don't see the two mysql files, then 1)either MySQL is not installed on your machine or 2)the newer versions of MySQL install somewhere else.

Harris said...

I had a problem with uninstalling..i deleted the files but then i couldnt install mySQL again..it said it was already installed in my hard drive.

Anyway, problem solved with
sudo rm -rf /var/db/receipts/com.mysql*

Many thanks!
Very helpful.

Anonymous said...

The full way is :
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- (or even if there is "NO")
rm -rf ~/Library/PreferencePanes/MySQL.prefPane
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*

Anonymous said...

Thanks a bunch!

George Iwu said...

Thanks very much, George from Nigeria