Sequel Pro and MySQL connection failed

Hattori Hanzō picture Hattori Hanzō · Jul 4, 2018 · Viewed 58.3k times · Source

I just installed mysql on mac from Homebrew

brew install mysql

mysql -V

mysql  Ver 8.0.11 for osx10.13 on x86_64 (Homebrew)

from terminal it works and I can login to mysql but from Sequel Pro it says

enter image description here

Unable to connect to host 127.0.0.1, or the request timed out.

Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).

MySQL said: Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/lib/plugin/caching_sha2_password.so, 2): image not found

can't figure out what I am missing

Answer

Maciej Kwas picture Maciej Kwas · Jul 4, 2018

This is because Sequel Pro is not ready yet for a new kind of user login, as the error states: there is no driver. Quick fix for non-homebrew installs:

Apple Logo > System Preferences > MySQL > Initialize Database, then type your new password and select 'Use legacy password'

After restart you should be able to connect. Do it only on fresh installs, because you may lost your db tables otherwise.

mysql + homebrew

Basically you will have to perform some actions manually, however- your database data won't be deleted like in solution above

  • Go to [my.cnf][1] file and in section [mysqld] add line:

    default-authentication-plugin=mysql_native_password

  • Login to mysql server from terminal: run mysql -u root -p, then inside shell execute this command (replacing [password] with your actual password):

    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '[password]';

  • exit from mysql shell with exit and run brew services restart mysql.

Should work.


my.cnf

The my.cnf file is located in /etc/my.cnf on Unix/Linux