Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

    brew remove mysql
    brew cleanup
  6. Remove files:

    sudo rm /usr/local/mysql
    sudo rm -rf /usr/local/var/mysql
    sudo rm -rf /usr/local/mysql*
    sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    sudo rm -rf /Library/StartupItems/MySQLCOM
    sudo rm -rf /Library/PreferencePanes/My*
  7. Unload previous MySQL Auto-Login:

    launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  8. Remove previous MySQL Configuration:

    # Edit this file: /etc/hostconfig
    # Remove the line MYSQLCOM=-YES-
  9. Remove previous MySQL Preferences:

    rm -rf ~/Library/PreferencePanes/My*
    sudo rm -rf /Library/Receipts/mysql*
    sudo rm -rf /Library/Receipts/MySQL*
    sudo rm -rf /private/var/db/receipts/*mysql*
  10. Restart your computer just to ensure any MySQL processes are killed

  11. Try to run mysql, it shouldn't work

Copy link

zhafed commented Apr 11, 2022

Append the following lines to:

  • /opt/homebrew/etc/my.cnf

  • /opt/homebrew/Cellar/mysql@5.7/5.7.37/.bottle/etc/my.cnf


Thanks @seemly it's worked , i spend 8 hours searching .

@seemly you saved me with these Comment : here

Copy link

bantya commented Jun 4, 2022

Thanks for this awesome guide.
@tnorthcutt's reply helped a lot!

Copy link

Rebek73 commented Jun 29, 2022

Thanks, it worked!!

Copy link

mkomigor commented Jul 1, 2022


Copy link

TienPV-ROR commented Jul 21, 2022


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment