Skip to content

Instantly share code, notes, and snippets.

@ierhyna
Created October 9, 2016 19:11
Show Gist options
  • Save ierhyna/7b6e191178a113a02f8354defe43d82c to your computer and use it in GitHub Desktop.
Save ierhyna/7b6e191178a113a02f8354defe43d82c to your computer and use it in GitHub Desktop.
How to install MySQL with Homebrew

Install MySQL

http://stackoverflow.com/questions/4359131/brew-install-mysql-on-mac-os/6378429#6378429

brew doctor and fix any errors
brew update
brew install mysql
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
mysql.server start

run the commands Brew suggests, add MySQL to launchctl so it automatically launches at startup

Remove MySQL

http://soatechlab.blogspot.com/2011/01/completely-remove-mysql-on-mac-os-x.html

ps -ax | grep mysql
stop and kill any MySQL processes
brew remove mysql
brew cleanup
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*
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
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*
sudo rm -rf /private/var/db/receipts/*mysql*

restart your computer just to ensure any MySQL processes are killed try to run mysql, it shouldn't work

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