Skip to content

Instantly share code, notes, and snippets.

@akabab
Forked from vitorbritto/rm_mysql.md
Last active November 14, 2018 20:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akabab/004bc380e12fe3c2c0384aaace179d4a to your computer and use it in GitHub Desktop.
Save akabab/004bc380e12fe3c2c0384aaace179d4a to your computer and use it in GitHub Desktop.
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. (Optional) Remove previous MySQL Configuration:

    subl /etc/hostconfig` 
    # Remove the line MYSQLCOM=-YES-
    
  9. (Optional) 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

Reinstall

brew install mysql

To connect run:

mysql -uroot

To have mysql started now and at login

brew services start mysql

Or to start it manually (if you don't want/need a background service)

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