Uninstalling MySQL on Mac OS X Leopard
To uninstall MySQL and completely remove it (including all databases) from your Mac do the following:
- Use mysqldump to backup your databases to text files!
- Stop the database server
- 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-
- rm -rf ~/Library/PreferencePanes/My*
- sudo rm -rf /Library/Receipts/mysql*
- sudo rm -rf /Library/Receipts/MySQL*
The last two lines are particularly important as otherwise, you can't install an older version of MySQL even though you think that you've completely deleted the newer version!

October 25th, 2008 at 13:17 #
Extremely helpful. Thank you!
October 26th, 2008 at 08:46 #
Perfect... Thanks
October 26th, 2008 at 09:45 #
thanks a lot it works properly.
October 26th, 2008 at 10:40 #
I'm glad it has helped others too!
Regards,
Rob...
October 29th, 2008 at 00:43 #
I had been struggling over my install for a while, and thanks to this post I was able to start over. Thank you so very much!
October 29th, 2008 at 14:38 #
Thank you! Exactly what I was looking for :)
November 29th, 2008 at 21:59 #
Thank you so much! This has been driving me nuts for the last couple of days.
December 30th, 2008 at 17:58 #
Thank you! It really saved my day!
January 18th, 2009 at 01:33 #
THANK YOU!!! I would kiss you if I could :)
March 7th, 2009 at 23:52 #
Thanks a lot! This is the only source I've found with great instructions on removing MySQL installs.
March 10th, 2009 at 15:36 #
Saved me a ton of time. Thanks a lot!
March 28th, 2009 at 13:28 #
Holy cow, thanks! Somehow the root account got screwed up and had to reinstall, this was perfect.
March 29th, 2009 at 21:22 #
This is excellent ... many thanks!
April 2nd, 2009 at 17:22 #
Awesome! Thank you very much.
April 16th, 2009 at 13:59 #
Thank you very much. It worked properly.
May 14th, 2009 at 17:46 #
Hi Rob,
After hunting high and low on the web, I came across your website. Great to find somebody that can write clearly and plainly about techie issues.
Wonder if you can help me? I'm using Tiger V10.4.11, and after several disastrous attempts to install MySQL on my Mac before discovering MAMP, I followed your steps above. I then installed MAMP and my Apache server works fine but the MySQL server fails to start. Question is - should I move to Leopard (and would this solve my problems) or is there something else peculiar to Tiger that I have to do...
Yours baffled
Jacqui
May 20th, 2009 at 18:39 #
At least I can have another attempt at MySQL on OS X without having to do a complete reinstall.
May 31st, 2009 at 15:14 #
Thank you for posting this; it helped me out. A couple of small things I noticed while running through the steps (OS X 10.5.7 / MySQL 5.1.34 x86_64 Pkg):
1. If you chose to install mySQL for 'this user only' then you'll want to delete the MySQL.prefPane directory from ~/Library/PreferencePanes rather than the system /Library/PreferencePanes.
2. The /usr/local directory doesn't exist with a default OS X installation. Provided that you haven't installed other applications that use it (check this first!), you can remove the entire /usr/local (rm -rf /usr/local).
3. I did notice that mySQL will create /usr/local if it doesn't exist, and /usr/local/include (though it is left empty), and /usr/local/lib with some Pkg directive that can be removed as well.
May 31st, 2009 at 20:45 #
Thanks for the info, Tom!
Regards,
Rob...
June 5th, 2009 at 12:48 #
Thank You for sharing your wisdom
I hope this gets me back up and running so that i can sleep....
Brett
June 12th, 2009 at 16:30 #
Thanks for the tips, Rob - much appreciated.
Just one note, possibly related to my problematic mySQL install (from package), there was nothing related to change in my /etc/hostconfig (10.5.7, mysql-5.1.35-osx10.5-x86_64)
July 8th, 2009 at 00:43 #
Please tell me what I am doing wrong
nosike-adahs-macbook:~ nosikeadah$ ls
Desktop Downloads Movies Pictures Sites
Documents Library Music Public
nosike-adahs-macbook:~ nosikeadah$ cd Library/
nosike-adahs-macbook:Library nosikeadah$ ls
Address Book Plug-Ins Keychains
Application Support LaunchAgents
Application Support:Adobe:Acrobat Logs
Assistants Mail
Audio Phones
Autosave Information PreferencePanes
Caches Preferences
Calendars Printers
ColorPickers PubSub
ColorSync Receipts
Compositions Safari
Cookies Screen Savers
Documentation Sounds
Favorites Spelling
FontCollections Thunderbird
Fonts Voices
Input Methods iMovie
Internet Plug-Ins iTunes
Keyboard Layouts
nosike-adahs-macbook:Library nosikeadah$ cd local
-bash: cd: local: No such file or directory
nosike-adahs-macbook:Library nosikeadah$ cd /usr
nosike-adahs-macbook:usr nosikeadah$ ls
X11 bin libexec sbin standalone
X11R6 lib local share
nosike-adahs-macbook:usr nosikeadah$ cd local
nosike-adahs-macbook:local nosikeadah$ ls
mysql-5.0.83-osx10.5-x86
nosike-adahs-macbook:local nosikeadah$ ls
mysql-5.0.83-osx10.5-x86
nosike-adahs-macbook:local nosikeadah$ cd mysql-5.0.83-osx10.5-x86/
nosike-adahs-macbook:mysql-5.0.83-osx10.5-x86 nosikeadah$ ls
COPYING configure man support-files
EXCEPTIONS-CLIENT data mysql-test tests
INSTALL-BINARY docs scripts
README include share
bin lib sql-bench
nosike-adahs-macbook:mysql-5.0.83-osx10.5-x86 nosikeadah$ cd ..
nosike-adahs-macbook:local nosikeadah$ cd ..
nosike-adahs-macbook:usr nosikeadah$ cd ..
nosike-adahs-macbook:/ nosikeadah$ cd ..
nosike-adahs-macbook:/ nosikeadah$ cd ..
nosike-adahs-macbook:/ nosikeadah$ sudo rm /usr/local/mysql
Password:
nosike-adahs-macbook:/ nosikeadah$ sudo rm -rf/usr/local/mysql*
Password:
nosike-adahs-macbook:/ nosikeadah$ sudo rm /usr/local/mysql
Password:
rm: /usr/local/mysql: No such file or directory
nosike-adahs-macbook:/ nosikeadah$ ls
Applications Volumes net
Desktop DB bin private
Desktop DF cores sbin
Library dev tmp
Network etc usr
System home var
User Guides And Information mach_kernel
Users mach_kernel.ctfsys
nosike-adahs-macbook:/ nosikeadah$ usr
-bash: usr: command not found
nosike-adahs-macbook:/ nosikeadah$ cd usr
nosike-adahs-macbook:usr nosikeadah$ ls
X11 bin libexec sbin standalone
X11R6 lib local share
nosike-adahs-macbook:usr nosikeadah$ cd local
nosike-adahs-macbook:local nosikeadah$ ls
mysql-5.0.83-osx10.5-x86
nosike-adahs-macbook:local nosikeadah$ cd mysql-5.0.83-osx10.5-x86/
nosike-adahs-macbook:mysql-5.0.83-osx10.5-x86 nosikeadah$ ls
COPYING configure man support-files
EXCEPTIONS-CLIENT data mysql-test tests
INSTALL-BINARY docs scripts
README include share
bin lib sql-bench
nosike-adahs-macbook:mysql-5.0.83-osx10.5-x86 nosikeadah$ cd lib
nosike-adahs-macbook:lib nosikeadah$ ls
libdbug.a libmysqlclient_r.15.dylib libndbclient.a
libmygcc.a libmysqlclient_r.a libndbclient.dylib
libmysql.imp libmysqlclient_r.dylib libndbclient.la
libmysqlclient.15.dylib libmystrings.a libz.a
libmysqlclient.a libmysys.a
libmysqlclient.dylib libndbclient.2.dylib
nosike-adahs-macbook:lib nosikeadah$ cd ..
nosike-adahs-macbook:mysql-5.0.83-osx10.5-x86 nosikeadah$ cd bin
nosike-adahs-macbook:bin nosikeadah$ ls
CMakeLists.txt mysqld_multi
comp_err mysqld_safe
comp_sql.c mysqldump
make_sharedlib_distribution mysqldumpslow
msql2mysql mysqlhotcopy
my_print_defaults mysqlimport
myisam_ftdump mysqlmanager
myisamchk mysqlshow
myisamlog mysqltest
myisampack mysqltestmanager
mysql mysqltestmanager-pwgen
mysql_client_test mysqltestmanagerc
mysql_config ndb_config
mysql_convert_table_format ndb_cpcd
mysql_explain_log ndb_delete_all
mysql_find_rows ndb_desc
mysql_fix_extensions ndb_drop_index
mysql_fix_privilege_tables ndb_drop_table
mysql_fix_privilege_tables_sql.c ndb_error_reporter
mysql_secure_installation ndb_mgm
mysql_setpermission ndb_mgmd
mysql_tableinfo ndb_restore
mysql_tzinfo_to_sql ndb_select_all
mysql_upgrade ndb_select_count
mysql_upgrade_shell ndb_show_tables
mysql_waitpid ndb_size.pl
mysql_zap ndb_test_platform
mysqlaccess ndb_waiter
mysqlaccess.conf ndbd
mysqladmin perror
mysqlbinlog replace
mysqlbug resolve_stack_dump
mysqlcheck resolveip
mysqld safe_mysqld
mysqld-debug
nosike-adahs-macbook:bin nosikeadah$ sudo rm mysql
nosike-adahs-macbook:bin nosikeadah$ sudo rm -rf mysql*
nosike-adahs-macbook:bin nosikeadah$ sudo rm -rf mysql*
nosike-adahs-macbook:bin nosikeadah$ sudo rm /usr/local/mysql
rm: /usr/local/mysql: No such file or directory
nosike-adahs-macbook:bin nosikeadah$ sudo rm /usr/local/mysqlmysql-5.0.83-osx10.5-x86/
rm: /usr/local/mysqlmysql-5.0.83-osx10.5-x86/: No such file or directory
nosike-adahs-macbook:bin nosikeadah$ sudo rm /usr/local/mysql-5.0.83-osx10.5-x86/
rm: /usr/local/mysql-5.0.83-osx10.5-x86/: is a directory
nosike-adahs-macbook:bin nosikeadah$ cd ..
nosike-adahs-macbook:mysql-5.0.83-osx10.5-x86 nosikeadah$ cd ..
nosike-adahs-macbook:local nosikeadah$ cd ..
nosike-adahs-macbook:usr nosikeadah$ cd ..
nosike-adahs-macbook:/ nosikeadah$ cd ..
nosike-adahs-macbook:/ nosikeadah$ sudo rm /usr/local/mysql-5.0.83-osx10.5-x86/
rm: /usr/local/mysql-5.0.83-osx10.5-x86/: is a directory
nosike-adahs-macbook:/ nosikeadah$ sudo rm /usr/local/mysql-5.0.83-osx10.5-x86
rm: /usr/local/mysql-5.0.83-osx10.5-x86: is a directory
nosike-adahs-macbook:/ nosikeadah$ sudo rm -rf/usr/local/mysql-5.0.83-osx10.5-x86*
rm: illegal option -- /
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
nosike-adahs-macbook:/ nosikeadah$ sudo rm -rf/usr/local/mysql-5.0.83-osx10.5-x86*
rm: illegal option -- /
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
nosike-adahs-macbook:/ nosikeadah$ sudo rm -rf/Library/StartupItems/MYSQLCOM
rm: illegal option -- /
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
nosike-adahs-macbook:/ nosikeadah$ sudo rm -rf/Library/PreferencePane/My*
rm: illegal option -- /
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
nosike-adahs-macbook:/ nosikeadah$ edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
nosike-adahs-macbook:/ nosikeadah$
July 8th, 2009 at 08:16 #
Nosike,
Try a space after the -rf:
Regards,
Rob...
July 8th, 2009 at 12:15 #
1.Thanks for the tip. I just have some more questions like how do I know it has worked?
2. After the first line I typed, I was asked for my password which I gave. Does this happen? The below is the result I got:
nosike-adahs-macbook:/ nosikeadah$ sudo rm -rf /usr/local/mysql-5.0.83-osx10.5-x86*
Password:
nosike-adahs-macbook:/ nosikeadah$ sudo rm -rf /Library/StartupItmes/MYSQLCOM
nosike-adahs-macbook:/ nosikeadah$ sudo rm -rf /Library/PreferencePane/My*
nosike-adahs-macbook:/ nosikeadah$ edit /etc/hostconfig
nosike-adahs-macbook:/ nosikeadah$ sudo rm -rf /Library/Receipts/mysql*
nosike-adahs-macbook:/ nosikeadah$ sudo rm -rf /Library/Receipts/MySQL*
nosike-adahs-macbook:/ nosikeadah$
July 8th, 2009 at 12:17 #
As it's *nix, you know that it's worked by the absence of error messages!
sudo will ask for a password, so that's expected. It remembers it for a while which is why you don't have to keep giving it.
Looks like you succeeded :)
Regards,
Rob...
July 8th, 2009 at 12:18 #
Also when I was editing hostconfig, the line:
MYSQLCOM=-YES- which you said should be deleted was this: MYSQLCOM=-NO- on my version of hostconfig but I still deleted that line anyway. I hope i have not done anything wrong
July 8th, 2009 at 12:22 #
Thank you very much for the help. It was very helpful. Now I can install it again thanks. By the way, I would like to know if you give tips for installing MySQL 5 on the leopard. I hope am not pushing my luck :-)
Thanks again ROB.
July 8th, 2009 at 16:19 #
Please can anyone help me with the steps to install MySQL 5.0 for leopard?
Thanks
August 12th, 2009 at 23:45 #
Thanks so much .. brilliant
August 28th, 2009 at 17:58 #
Hi Rob, Thanks for the instructions! I wrote up a short article after getting mysql uninstalled, check it out if you like:
http://obscuredclarity.blogspot.com/2009/08/uninstall-mysql-on-mac-os-x.html
August 29th, 2009 at 08:38 #
Helpful, but may I point out that you missed out the preference pane folder in "USERNAME/Library/PreferencePanes/". Some people install them just for a specific user.
August 29th, 2009 at 08:50 #
Thanks, Yun4 :)
Regards,
Rob...
August 31st, 2009 at 16:40 #
Extremely helpful. Thank you.
September 8th, 2009 at 14:49 #
Hi thanks for the exact help that i was looking for :)
But when i again tried to reinstall it from .dmg file it installed but i wasn't able to connect it, it says socket
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Can you help me out in it ASAP??
September 30th, 2009 at 08:49 #
Thanks for this, really helpful. Only thing is if you are running snow leopard, and have installed the wrong version accidently (i installed the 64bit power pc version), you need to do two extra steps to completely remove the previous verison.
They are detailed here:
http://www.silverscripting.com/blog/2009/09/04/removing-mysql-on-snow-leopard/
October 21st, 2009 at 17:46 #
Hi,
I'm trying to uninstall MySQL using these commands but when I reach this line:
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
I get this message: -bash: edit: command not found
I then tried to find where it is (whereis edit) but nothing happens.
Can you help me please? Thank you!
October 21st, 2009 at 21:01 #
Sofia,
Edit is an instruction, not a command. Having said that, if you install TextWrangler's command line tool, then you will have an "edit" command in terminal.
Regards,
Rob...
October 21st, 2009 at 22:21 #
Ah! Thank you, english is not my language, sometimes I get confused.
Thank you again.
October 25th, 2009 at 17:48 #
Thanks for the information first
But have a MAJOR issue here
1 I have a back up in my "Time Machine" So I know it's all backed up somewhere
2 I upgraded to 10.6 so all went smoothly
3 Until I went to check mySQL where my Cold Fusion is called it, This is where the issues arose
Cold Fusion is working not an issue I did a simple "hello"
But when I ran mysql to check the db I got an error
so I followed the instructions listed above and REMOVED the old sql and installed the new db
NOW I discover ALL my old Databases ARE GONE
How do I get it back?
I have like I said "Time Machine" but where are my file to move them back?
I attemped to move
to move the files from the "Time Machine" from /usr/local/mysql back to my machine in 10.6 but the old mysql is NOT compatible
I was thinking I could reinstall the old mysql but which file contain the data files that I can just pick up and move back to my machine or is this really possible?
October 25th, 2009 at 17:54 #
forgot to mention
old sql
4.0.67-osx10.5-x86_64
new sql is
5.1.40-osx10.5x86-64
October 26th, 2009 at 07:55 #
ron,
I would expect that you will find the data is in /usr/local/mysql4.0.67-osx10.5-x86_64/data.
(shift+cmd+g is useful in finder to go to the folder, or navigate via Terminal and then do "open .")
However, I suspect that to change major versions, you would need to do a mysqldump to convert the data to text format. http://dev.mysql.com/doc/refman/5.1/en/upgrade.html may help.
Regards,
Rob...
October 27th, 2009 at 13:11 #
Rob
thanks... converting was too complicated
I used the time back up on the mac went back to 4.0 mysql on my computer did a data dump as you mention then used time back up on the mac again and went back to 5.0 and took the data back in and worked great
thanks :)
November 25th, 2009 at 12:24 #
Hi,
I have installed MySQL6 and as it won't run I tried to use MySQL5. After all these steps to delete all MySQL entries from the disk I still will not be able to install the MySQL5 version. The installed tells me, that there is still a new version of MySQL an the system and it will not continue.
How does the installed knows that?
Regards,
Dirk
November 25th, 2009 at 12:33 #
Hi all,
I've found the reason in an other blog.
If you've installed MySQL 5.4.1 (or higher) you will also have to remove any *mysql* preference files from here:
/private/var/db/receipts/
...as well as any other receipts folder mentioned above.
December 6th, 2009 at 20:48 #
You might want to add the following two lines to the beginning of the process:
"# Back up all your databases ( just in case ;)"
"sudo kill `sudo cat /usr/local/mysql/data/${HOSTNAME}.pid`"
This will gracefully kill mysqld if it is running. "ps -u mysql" should display a process if it is running.
December 13th, 2009 at 22:45 #
I have a problem with:
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
after i hit enter it says
-bash: edit: command not found
everything else works great
but because that one command doesn't work, it doesn't successfully uninstall mysql.
please heeelpppp
December 14th, 2009 at 10:08 #
Jake,
Read comment #37.
Regards,
Rob...
December 30th, 2009 at 18:45 #
add this one:
sudo rm -rf /var/db/receipts/com.mysql.*
February 7th, 2010 at 15:27 #
Hi,
I downloaded Mac OS X 10.5 (x86, 64-bit), DMG Archive from http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg
and having a bit of a problem. Installation went fine, but when trying to start it, I get this:
Error
Could not startup MySQL server
Reason 255
Is there any chance that the version I downloaded, and/or its specific mirror was faulty? Double checked my comp display, and it's 32 bit. Should I have downloaded the 32 bit version?
Thank you.
February 7th, 2010 at 16:25 #
Quick update.
Had a little help, and got it worked out.
February 15th, 2010 at 18:09 #
I've followed these instructions, but for some reason I have a directory: usr/local/mysql-5.5.0-m2-osx10.6-x86 which has multiple (more than 30) identical, empty directories within it.
I've tried deleting it using your:
sudo rm -rf /usr/local/mysql*
command, but it will not delete...
At the moment I can't re-install MySql because of this folder.
Any tips on how I can get around this?
Thanks!
February 15th, 2010 at 18:13 #
Actually forget my last post - I opened it in Finder instead of my text editor and it deleted no problem
February 17th, 2010 at 17:14 #
Thanks a lot Rob, saved me lots of time!
May 5th, 2010 at 03:56 #
Helped, but I did have to also delete the following:
/private/var/db/receipts/com.mysql.mysql.bom
/private/var/db/receipts/com.mysql.mysql.plist
/private/var/db/receipts/com.mysql.mysqlstartup.bom
/private/var/db/receipts/com.mysql.mysqlstartup.plist
Once I did that I was able to install an older version.
May 20th, 2010 at 18:00 #
Thanks! Worked for me in Snow Leopard. Added this line, as well:
sudo rm -rf /var/db/receipts/com.mysql.*