Sequel Pro and MySQL connection failed
Asked Answered
P

8

131

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

Predecease answered 4/7, 2018 at 18:49 Comment(0)
P
239

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

mysql + homebrew

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

  • Go to my.cnf 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.

Quick fix (destructive method)

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.


my.cnf

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


Alternatives

For those who is still struggling with Sequel Pro problems: Sequel Pro was a great product, but with tons of unresolved issues and last release being dated to 2016 perhaps it's a good idea to look for some alternatives. There is a fork of SequelPro called SequelAce that seems to be pretty stable and up-to-date, it keeps similar functionality, similar look and feel, yet at the same time it is devoid of old Sequel Pro problems
Pentheam answered 4/7, 2018 at 21:23 Comment(19)
I can't find MySQL in System PreferencesCherie
thanks for explain, but can't locate my.cnf file on my machine(macOS High Sierra 10.13.5)Cherie
If there is no such file, you will have to create one: please, have a look at this thread: #7974427Pentheam
I also don't have mysql in my system preferences, and didn't find the my.cnf inside /etc, but found it via $ brew list mysql | grep my.cnf in /usr/local/Cellar/mysql/8.0.12/.bottle/etc/my.cnf on macOS and mysql installed via homebrew. Editing it there and then following the commands from this answer solved OPs problem for me which I also faced.Doggish
Hmm... followed the proposed solution. Authentication appears to work, however, now the schema/tables fail to load and a generic "Unexpected error occurred". Issue detailed on the repo here: github.com/sequelpro/sequelpro/issues/2699Butch
This worked great on a fresh brew install mysql using /usr/local/etc/my.cnfRetinol
didnt work for me, after I did that I started getting more errors :( ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)Schizomycete
Updated my.cnf file, logged into mysql server, command to change password returned ERROR 1726 (HY000): Storage engine 'MyISAM' does not support system tables. [mysql.db] A full uninstall en reinstall fixed this for me: coderwall.com/p/os6woq/…Hampden
Is the fault of Sequel Pro? "This is because Sequel Pro is not ready yet for a new kind of user login" sounds pretty vague. Should we use a better client?Extrauterine
@Extrauterine at the time of writing the answer none of the clients I knew were able to connect without errors. I don't know how the situation looks like now, but 'better client' question is pretty subjective here, Sequel Pro is a good option and I'm still using it, if you will find better alternative is only up to you.Pentheam
I ended up using an older MySQL version in my docker composer so I could stay with Sequel Pro.Extrauterine
It's a great if you are fine with changing your car, because you are in love with a tire brand. A secure alternative is changing the tire brand you are in love with. See my answer below.Notch
I didn't use a password, so I used ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''; - this worked for meVocalist
worked for me, just remembering to set it password when connection on your CLI as well (dbeaver, workbench etc...)Bullnecked
On OSX Mojave, the my.cnf file is at /usr/local/etc/my.cnfJetty
This worked, however only unintentionally adopting the destructive method, which unfortunately comes first. Let me suggest to flip the order, since, like me, someone can ruin their DB, without being aware of this implication.Coronograph
It works for MySQL 8.~ of Homebrew installation on Macbook Air M1. ThanksLungfish
Brilliant! So stupid I did not look at clicking on "Initialize Database". By the way you can also do FLUSH PRIVILEGES; ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPassword'; and you can access db by doing this: sudo /usr/local/mysql/support-files/mysql.server stop (or click on "Stop MySQL Server) You can also check System Preferences > MySQL to see if it is running Start MySQL with this command:` sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables Open a new terminal window/tab:` sudo /usr/local/mysql/bin/mysql -u root - see https://mcmap.net/q/56376/-access-denied-for-user-root-mysql-on-mac-osZalucki
but actually with MacOS It worked only by clicking on "Initialise Database" in Mysql (accessible from System settings of Mac settings) and then set as password my new passwordZalucki
N
74

TL;DR: Sequel Pro is dead since 2016. Don't downgrade your DB because of a tool. Move on to an alternative tool.

Update 2020: Sequel Pro is officially dead but unofficially alive! You can find the "nightly" builds that don't have this issue (i.e. support Mysql 8 auth) in here: https://sequelpro.com/test-builds

Update 2021: Sequel Ace is a good similar alive alternative: https://github.com/Sequel-Ace/Sequel-Ace#installation (Credits to Maciej Kwas's answer)


All the other solutions here are recommending changing your DB settings (making it less secure, as advertised by MySQL) for the tool you are using. That's not acceptable to me.

I have always been a huge fan of Sequel Pro, even donated to it. But, with all my passion and love, I am sorry if the tool doesn't have any release since 2016. YOLO, and I need to move on!

The alternative I found (from https://mcmap.net/q/56377/-authentication-plugin-39-caching_sha2_password-39-cannot-be-loaded, thanks to @arcseldon) is DBeaver which supports MySQL 8's new authentication (non-legacy) method.

PS. The only trick in the tool side, not the DB side is when you are creating a MySQL 8 connection you might need to go to "Driver Properties" (later can be found in Edit Connection) and turn the value of allowPublicKeyRetrieval to true.

I needed this to connect to my MySQL container created using Docker. To have the IP of MySQL be visible to the outside, for any other application in your ecosystem (not just this tool), you should either create a new user in MySQL, or pass -e MYSQL_ROOT_HOST=% in the run-time or as an ENV.

Notch answered 31/5, 2019 at 22:9 Comment(6)
I believe @Notch you gave me a downvote just because my answer does not resolves the OP problem. It's just a local development and local settings- so what's the point? Do I really have to leave software I am familiar with and I like to work with just because you say so?Pentheam
Please don't take it personal @MaciejKwas. Despite providing more explanation here, which I appreciate, I am still standing by my vote. The three main reasons are: 1) Maintaining different setup between dev/prod is not recommended in modern software development. It's, in fact, factor X of 12factor.net/dev-prod-parity . 2) People can use these tools for checking prod as well. You can create a ssh-tunnel/proxy and get to your prod DB via a GUI tool. In such cases, downgrading the DB auth is not an option. 3) Not adapting to change and upgrade is something I don't value, personally.Notch
I'm coming back to a MySQL project I haven't ran locally in a couple years b/c it's been rock solid and i'm so sad to find out that sequel pro is dead :(Peppel
Also choose the MySQL +8 driver in DBeaver as there are multiple drivers to choose from. In the driver properties set allowPublicKeyRetrieval to true and save.Lovegrass
That's a shame because Sequel Pro has a great icon.Disbar
OMG, you made my day with Sequel Ace tip! Thank you!Gastrectomy
T
21

Sequel Pro is officially dead and no longer supports newer MySql features. However, the good news is that it was replaced by Sequel Ace which is available on GitHub and App store. The app is free of charge and looks like official replacement for Sequel Pro as the post was made by one of the collaborators of Sequel Pro.

Ps. I decided to post this as an answer as others have not mentioned that there is now an up-to-date replacement for Sequel Pro

Trimerous answered 15/7, 2020 at 23:40 Comment(2)
Thanks for news, much appreciated.Cherie
Finally! Been waiting for a while.Extrauterine
C
20
  1. Assuming you don't have a mysql configuration, echo the following to ~/.my.conf.

    [mysqld]
    default-authentication-plugin=mysql_native_password
    
  2. Sign into mysql with mysql -u root -p

  3. Set the root user password with ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '[PASSWORD]'; where [PASSWORD] is a password of your choosing.

  4. Restart mysql with e.g. brew services restart mysql

Constrictive answered 16/1, 2019 at 23:56 Comment(1)
It's a great solution if you realllllllllllly don't care about anything and it's just a local, dev, test-only, practice, one-time, throw-away database. Read stackoverflow.com/a/56509065 for the explanation of why it's a bad idea to change DB, because of a tool.Notch
C
6

If you connect to MySQL via [email protected], make sure that you reset its password too!

ALTER USER 'root'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY '[password]';
Cyclo answered 19/12, 2018 at 13:15 Comment(4)
I am getting: ERROR 3009 (HY000): Column count of mysql.user is wrong. Expected 50, found 49. Created with MySQL 80012, now running 80013. Please use mysql_upgrade to fix this error.Chantalchantalle
try this on the terminal: mysql_upgrade --force -uroot -pCyclo
mysql_upgrade has now been deprecated and won't work, use mysqld --upgrade=FORCE instead.Tropology
It's a great solution if you realllllllllllly don't care about anything and it's just a local, dev, test-only, practice, one-time, throw-away database. Read stackoverflow.com/a/56509065 for the explanation of why it's a bad idea to change DB, because of a tool.Notch
A
5

It's working for me. if you are getting this error :

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):

Plz try this solution

enter image description here

Amphicoelous answered 23/7, 2020 at 15:26 Comment(2)
Worked like a charm.Patronize
It's a great solution if you realllllllllllly don't care about anything and it's just a local, dev, test-only, practice, one-time, throw-away database. Read stackoverflow.com/a/56509065 for the explanation of why it's a bad idea to change DB, because of a tool.Notch
V
2

If anyone facing this issue and installed MySQL version > 8 through .dmg file; downloaded it from the official link. In that case please use this guideline. I am adding the same details below in case the link will not be available in the future.

This issue is because you're using the new Strong Password Encryption which is a new feature in MySQL 8, if you installed MySQL 8 using the .dmg file, you can go to System Preferences > MySQL and then click on Initialize Database type your password and select the second option Use Legacy Password Encryption.

Vocalize answered 18/2, 2020 at 9:59 Comment(1)
Using a old style password worked for me. Thank you!Washy
B
-1

My M1 Mac running Ventura 13.5 had my.cnf located /System/Volumes/Data/opt/homebrew/etc/my.cnf

Bolster answered 9/3 at 0:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.