How to remove MySQL completely Mac OS X Leopard

Written on 23-10-2008 – 20:16:25 | by Tom Keur

Hi,

After I’ve been searching alot I finally mananged it to delete MySQL from my Macbook pro.

The steps:

First you need to edit the file in: /etc/hostconfig and remove the line

Since this is a system file I advise you to open it with nano in terminal:

  1. Open Terminal
  2. sudo nano /etc/hostconfig
  3. Enter your password if you’re not authed yet.
  4. Delete the following line: “MYSQLCOM=-YES-”
  5. CTRL+X (This is the command for closing NANO, Enter the “Y” key to save the file and exit nano).

Second step:

Make sure MySQL is not running.

  1. Open Terminal and copy and paste and run the following commands:
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/MySQL*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm /etc/my.cnf

MySQL is now removed from your MAC.

Edit 26-02-2009:  Maarten van der Pee wrote a comment that it’s allso needed to delete the my.conf, I added it to the list of commands. Thanks Maarten!

  1. 67 Responses to “How to remove MySQL completely Mac OS X Leopard”

  2. By Fabian on Feb 8, 2009 | Reply

    I spent hours trying to remove mysql from my MacBook in order to re-install. None of the information that I found online seemed to work until I tried your method. Thank you very much!

  3. By Tubby on Feb 11, 2009 | Reply

    Goodie, need to do try this xD

  4. By Maarten van der Peet on Feb 25, 2009 | Reply

    Don’t forget sudo rm /etc/my.cnf
    If you want to try out MAMP you get mysql socket problems if you don’t delete this file

  5. By Daytona on Feb 26, 2009 | Reply

    Just wanted to say thank. Like Fabian, I spent hours trying to find a way to remove it, all I found was people asking, and everyone else telling them not to. :(

    You were a BIG BIG BIG help.

    Cheers Mate

    Daytona

  6. By Andrew on Apr 23, 2009 | Reply

    In your code sample you have my.cnf. is that supposed to be my.conf?

  7. By Tom Keur on May 1, 2009 | Reply

    Hey,

    Yeah it’s my.conf I changed my post.
    Thanks for the comment (:.

  8. By strangelove on May 14, 2009 | Reply

    thanks mate

  9. By Matthew Brand on Jun 23, 2009 | Reply

    Thanks.

    The writers of mysql should just make it easier to uninstall their product. I have no idea why they have made that so difficult to do.

  10. By anyabelle on Jun 29, 2009 | Reply

    Thanks :)

  11. By Salomon Lee on Jul 8, 2009 | Reply

    Thanks. It was a great help.

  12. By Liz on Jul 16, 2009 | Reply

    Another place I went to before this forum didn’t say to delete the MYSQLCOM=-YES- line beforehand….I went to do this after having already completed all the other steps. Now MYSQLCOM=-YES- can’t be deleted it seems. I think everything else is uninstalled?? I am new to this, so I’m having a hard time trying to figure out what’s wrong. Any help would be appreciated!!

  13. By Pablo on Aug 25, 2009 | Reply

    Thanks! Big help!

  14. By ProjectBuilder on Dec 1, 2009 | Reply

    Thank you for this post, excellent short guide to remove MySQL from Mac!

  15. By Tony on Dec 21, 2009 | Reply

    Thanks for this. I’m not terminal savy and rely on bbedit a lot. Though it can see system files it can’t delete them.
    Thanks again.

  16. By Amir on Dec 30, 2009 | Reply

    Thanks but add this one:
    sudo rm -rf /var/db/receipts/com.mysql.*
    I can’t install another version before doing that.

  17. By Anoop Sharma on Jan 3, 2010 | Reply

    Thank you so much.

    Tried to find the info on the mysql webpage and could not find it on there. You have been a great help. Thanks

  18. By jeet on Jan 5, 2010 | Reply

    Thanks a lot…..i was looking for help on net for removing mysql cluster 7.0.9. :) thanks once again

  19. By Ricardo on Feb 12, 2010 | Reply

    cool one! cheers man!

  20. By Ed on Feb 14, 2010 | Reply

    Thanks I could not figure out the uninstall so that I can start fresh.

  21. By cavin on Feb 25, 2010 | Reply

    thanks.

  22. By Mutia Fijri Taufani on Mar 9, 2010 | Reply

    thanx for your information, i’ve been searching for an hour, and finally got the solution here..thank you!

  23. By Tyson on Mar 21, 2010 | Reply

    You are a scholar and a gentleman. A few other methods I tried didn’t work, but this did. Thanks for posting.

  24. By Matt on Mar 23, 2010 | Reply

    For snow leopard you also need:
    sudo rm -rf /var/db/receipts/com.mysql.mysql*

    Taken from:
    http://egopoly.com/2009/09/01/how-to-uninstall-mysql-5-1-on-snow-leopard/comment-page-1/#comment-21682

  25. By Katie Bradshaw on May 28, 2010 | Reply

    I have no experience using Terminal. I am trying to erase MySQL also. I went into terminal and typed “sudo nano /etc/hostconfig, then entered my password and got the following:
    Last login: Thu May 27 22:26:54 on ttys000
    Katie-Bradshaws-MacBook-Pro:~ kbmacbk$
    Katie-Bradshaws-MacBook-Pro:~ kbmacbk$ sudo nano /etc/hostconfig
    Password:

    GNU nano 2.0.6 File: /etc/hostconfig Modified

    # This file is going away

    AFPSERVER=-NO-
    AUTHSERVER=-NO-
    AUTOMOUNT=-YES-
    NFSLOCKS=-AUTOMATIC-
    NISDOMAIN=-NO-
    TIMESYNC=-YES-
    QTSSERVER=-NO-
    WEBSERVER=-NO-
    SMBSERVER=-NO-
    SNMPSERVER=-NO-
    MYSQLCOM=-YES-

    [ Read 13 lines ]
    ^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
    ^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text^T To Spell

    I highlighted the line “MYSQLCOM=-YES-, and then hit the delete button and it won’t go away. Am I suppose to type “^K” to cut text? How do I delete that line? I do hope someone sees this and can help. I’d be much obliged. Thanks!

  26. By Akshay on Jul 15, 2010 | Reply

    Thanks a lot for posting that. its so going to help me and my whole team here.
    Would you also have the solution to the problem of granting access to the users in Mysql.

    when i run the follwing command from the root user :
    GRANT ALL PRIVILEGES ON *.* TO ‘store_user’@'localhost’ IDENTIFIED BY ‘store_user123′ WITH GRANT OPTION ;

    and try loggin in through the store_user i get the following error :
    ERROR 1045 (28000): Access denied for user ‘store_user’@'localhost’ (using password: NO)

    Please share your views.
    Thanks once again…

  27. By freddy on Jul 19, 2010 | Reply

    sudo rm /etc/my.conf gives me ‘No such file or directory’ – I’m a bit new to all this so can anyone suggest what it means please?

    Many thanks

  28. By oreason on Jul 25, 2010 | Reply

    YEEEEEEAHHH ! THANKS ALOOOOT

  29. By Ken on Nov 7, 2010 | Reply

    Thank you! Very clear and concise instructions.

  30. By rahadian on Nov 25, 2010 | Reply

    Big Thanks!

  31. By Skoltz on Dec 11, 2010 | Reply

    I can’t remove MySQL 5.5.7 T-T
    Help !

  32. By Bruno Windels on Dec 17, 2010 | Reply

    It seems that the installer since a certain version also keeps files in /private/var/db/receipts/ that all start with com.mysql , to be specific

    /private/var/db/receipts/com.mysql.mysql.plist
    /private/var/db/receipts/com.mysql.mysql.bom

    I have noticed problems when using the above instructions to reinstall a previous version. The installer won’t let you continue.

    If you remove the above files (at your own risk), the installer let’s you continue.

  33. By Saria on Dec 19, 2010 | Reply

    same problem
    sudo rm /etc/my.conf gives me ‘No such file or directory’ – what it means please?

  34. By hxhxd on Dec 28, 2010 | Reply

    Thanks very much for the tips!

  35. By Adeel Azmat on Jan 16, 2011 | Reply

    Thanks a lot for the instructions. Appreciate it !

  36. By Augusto on Feb 5, 2011 | Reply

    @Skoltz

    for 5.5 you also need to run
    sudo rm /var/db/dslocal/nodes/Default/groups/_mysql.plist
    sudo rm /var/db/dslocal/nodes/Default/users/_mysql.plist
    sudo rm /var/db/receipts/com.mysql.mysql.bom
    sudo rm /var/db/receipts/com.mysql.mysql..plist

  37. By bate_g on Feb 24, 2011 | Reply

    Thanks a lot! You save me a lot of time…

  38. By slain.dev on Mar 10, 2011 | Reply

    That’s really worked on my mac.
    THX

    I’ve installed the MySQL by the dmg archive but it seems does not work, after uninstall it, i will try again. I hope this time it would turn to be okay.

    thanks anyway.

  39. By cheap Jeans on Mar 29, 2011 | Reply

    Howdy that’s a very interesting view, It does give one food for thought, I am very delighted I stumbled on your blog, in any case i don’t want to drift on too much, but i would like to mention that I will be back when I have a little time to read your blog more thoroughly, Once again thanks a lot for the post and please do keep up the right work,

  40. By Bob Tabor on Apr 30, 2011 | Reply

    Thank you good sir, you are still helping people lo these many years after you first posted this. I was trying to fix a botched MAMP PRO install that had an issue with a botched uninstall of MySQL from months ago. This worked beautifully!

  41. By Prageeth Karunadheera on May 4, 2011 | Reply

    Thanks for this.

    Hi Matt, your command completed the process.

    By Matt on Mar 23, 2010 | Reply
    For snow leopard you also need:
    sudo rm -rf /var/db/receipts/com.mysql.mysql*

    Taken from:
    http://egopoly.com/2009/09/01/how-to-uninstall-mysql-5-1-on-snow-leopard/comment-page-1/#comment-21682

  42. By Seth Freeman on May 10, 2011 | Reply

    Thanks! Works like a charm.

  43. By vijay on May 18, 2011 | Reply

    Perfect solution, you need to remove the private files also
    /private/var/db/receipts/com.mysql.mysql.bom

    /private/var/db/receipts/com.mysql.mysql.plist

  44. By Ben Stratton-Woodward on Jun 16, 2011 | Reply

    Thanks – very clear instructions – worked a treat.
    rm commands that flicked up an error I just went to the location and removed MySql associated files.
    I used vi to edit the hostconfig file:
    sudo vi /etc/hostconfig [‘i’ for insert mode then delete the MySql Line then ‘esc’ button to exit insert mode then ‘:wq’ to write and quit.

  45. By redder on Jul 15, 2011 | Reply

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

    That fixed it for me THANKS.

  46. By Vladislav Muravyev on Aug 14, 2011 | Reply

    As was described before, for Lion also need to do:
    sudo rm /var/db/receipts/com.mysql*
    sudo rm /var/db/dslocal/nodes/Default/groups/_mysql.plist
    sudo rm /var/db/dslocal/nodes/Default/users/_mysql.plist
    (if mysql was running)
    sudo rm /private/tmp/mysql.sock
    And may be also:
    sudo rm /System/Library/DirectoryServices/DefaultLocalDB/Default/groups/_mysql.plist
    sudo rm /System/Library/DirectoryServices/DefaultLocalDB/Default/users/_mysql.plist
    sudo rm /Library/Logs/DiagnosticReports/mysqld_*

  47. By Shin on Aug 17, 2011 | Reply

    I follow the instruction, but instead of “MYSQLCOM=-YES-” I faced with “MYSQLCOM=-No-”. What should I do now? Thanks in advance for helping me.

  48. By Young on Nov 24, 2011 | Reply

    Thank you!!!!

  49. By macPro on Jan 19, 2012 | Reply

    Many of many thanks go to you.
    I have been stuck in a serious problem with MySQL.
    thanks again for your help.

  50. By siba on Feb 14, 2012 | Reply

    Your blog is the best on this subject. Helped me a lot. Thank you.

  51. By true religion jeans on May 31, 2012 | Reply

    I used vi to edit the hostconfig file:
    sudo vi /etc/hostconfig [‘i’ for insert mode then delete the MySql Line then ‘esc’ button to exit insert mode then ‘:wq’ to write and quit.

  52. By free coder on Jul 13, 2012 | Reply

    Thanks. Good Artical

  53. By free coder on Jul 13, 2012 | Reply

    Good Article

  54. By Paulo Renato on Oct 19, 2012 | Reply

    Thanks

  55. By Jongosi on Nov 20, 2012 | Reply

    if you have several users, and especially administrators, make sure you do this process for EACH user! Spent about 3 hours scratching my head.

    If I have to read one more `killall -9 mysqld`, I dunno :’(
    Thx for a great post!

  56. By Biinnert on Dec 8, 2012 | Reply

    YES cool, this is on other that is missing…. how on earth did you find this?

  57. By Franck Dernoncourt on Jun 12, 2013 | Reply

    “sudo rm -rf /Library/PreferencePanes/My*
    ” is dangerous. Replace by “sudo rm -rf /Library/PreferencePanes/MySQL*”

  58. By Saba on Jul 25, 2013 | Reply

    Thanks for this..very helpful..

  59. By jaggs on Oct 2, 2013 | Reply

    Thanks a lot.

  60. By Tom Keur on Oct 23, 2013 | Reply

    Thanks!
    I changed it in my blogpost.

  1. 8 Trackback(s)

  2. Sep 29, 2009: Passaggio a Snow Leopard: scordatevi i database - Mac + Web
  3. Sep 29, 2009: La gemma di MySQL non funziona - Mac + Web
  4. May 17, 2010: Mess of Pottage » MySQL reinstallation notes
  5. Jun 14, 2010: Mac’de Mysql Dosyalarını Tamamen Kaldırmak | Ehocam.Com
  6. Dec 16, 2010: How to remove MySQL completely Mac OS X Leopard | Tom Keurs Blog « Blah!
  7. Jan 24, 2011: We’re finally up and running!!! « Chris Robinson's Blog
  8. Aug 21, 2011: Mac OSX Leopard 如何移除 MySQL « 蘿莉控八控恐-控揪離-控控恐 的自由空間 "
  9. Jan 28, 2012: Help! Can’t Re-install on Macbook (no replies) | Coders & Admins

Post a Comment