Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save smhz101/92eb1c6ff1bf09ba8d4fdb8423c3e5c7 to your computer and use it in GitHub Desktop.
Save smhz101/92eb1c6ff1bf09ba8d4fdb8423c3e5c7 to your computer and use it in GitHub Desktop.

Uninstall via HomeBrew

  • $ brew uninstall mysql
  • $ brew doctor
  • $ brew prune
  • $ brew cleanup

Manually remove mysql from macOS Sierra

Search if mysql is currently running in background:

  • $ ps -ax | grep mysql
  • stop and kill any MySQL processes

Remove following items:

  • $ 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*

Unload launch control:

  • $ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  • edit $ /etc/hostconfig and remove the line MYSQLCOM=-YES-

Remove following items as well:

  • $ 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*

Now try to run

  • $ mysql (it shouldn't work)

Install Mysql via Homebrew

  • $ brew install mysql
  • $ brew services start mysql
  • $ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
  • $ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

For Sequal Pro

Connection Failed

To find the path of my.cnf

  • $ brew list mysql

  • $ cp /brew_path_of_mysql_my_cnf_file/my.cnf /etc/my.cnf

  • i.e $ cp /usr/local/Cellar/mysql/8.0.12/.bottle/etc/my.cnf /etc/my.cnf

In my.cnf file

in section [mysqld] add line:

  • default-authentication-plugin=mysql_native_password

Now go to terminal

  • $ mysql -u root -p

Add password to secure local mysql server

  • $ ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR_PASSWORD_HERE';

Give it all privileges:

  • $ GRANT ALL PRIVILEGES ON * . * TO 'root'@'localhost';

Then to reload newly assigned permissions run:

  • $ FLUSH PRIVILEGES;
  • $ exit from mysql terminal and close and restart the terminal

Restart mysql server

  • $ brew services restart mysql

REF: https://stackoverflow.com/questions/51179516/sequel-pro-and-mysql-connection-failed

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