Sequel Pro and MySQL connection failed - mysql

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

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

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://stackoverflow.com/a/55235533/2321594, 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.

Assuming you don't have a mysql configuration, echo the following to ~/.my.conf
[mysqld]
default-authentication-plugin=mysql_native_password
Sign into mysql with mysql -u root -p
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.
Restart mysql with e.g. brew services restart mysql

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

If you connect to MySQL via root#127.0.0.1, make sure that you reset its password too!
ALTER USER 'root'#'127.0.0.1' IDENTIFIED WITH mysql_native_password BY '[password]';

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

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.

Related

Win Server 2019 - XAMPP - MYSQL Access denied for user ''#'localhost' (using password: NO)

I've been browsing the web and this site from other users which have had this issue and reading the comments to resolve however I've not had much luck and i'm going bonkers trying to work out the issue.
I have two servers - Win Server 2019 and both use XAMPP with Apache and MYSQL, the first server (1) has been running for over a year perfectly fine, however I'm setting up another server (2) to use as a test environment but with a fresh install of windows, xampp along with the Apache/MYSQL modules.
I'm using Invision Community application but I'm getting this upon the first page of installation:
MySQL Requirements
Fatal error: Uncaught mysqli_sql_exception: Access denied for user ''#'localhost' (using password: NO) in C:\xampp\htdocs\ips4.php:317 Stack trace: #0 C:\xampp\htdocs\ips4.php(317): mysqli->__construct('localhost') #1 C:\xampp\htdocs\ips4.php(340): my_mysqli->__construct('localhost') #2 {main} thrown in C:\xampp\htdocs\ips4.php on line 317
IPS4.php is just a file to state whether the server meets all the requirements for the application.
I've then compared MYSQL on (1) to the install on (2) and I've matched the details, given privileges to "root" user on all of the available databases within PHPMYADMIN, granted full grants and then reloaded them, restarted MYSQL and Apache and still same issue.
Normally the Invision software continues through to then request the database details, user details etc. but it hasn't got to that point yet.
The only differences I can see between both servers is (1) is running PHP 7.3.7 | Apache 2.4.39 | MySQL 5.0.12 and server (2) is running PHP 8.2.0 | Apache 2.4.54 | MySQL 8.2.0
I was hoping I would just install XAMPP and then transfer the files to install the software and then configure it to choose which DB/User and then install and get started but apparently not.
ROOT doesn't have a password on (2) but does on (1), when I add a password to (2), I'm then unable to access PHPMYADMIN and doesn't ask for a password to log in. I've spent a few hours today trying to resolve this but now I think I'd like some advice. Many thanks
Setting root password, then flushing privileges, granting full permissions on all databases, copying the mysql files from server (1) to server (2). uninstalling XAMPP and reinstalling.
I don't recall ever needing to do anything for permissions when I setup this software on server (1). I've also installed this software on a few linux servers but didn't enjoy using linux so I stopped using it.
EDIT: It seems it's using MariaDB 10.4.27
Set a password for root on (2).
Change the phpMyAdmin config.inc.php file,change
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = '';
$cfg['Servers'][$i]['password'] = '';
then phpMyAdmin will throw a login dialog and ask for a user/password
That should sort out the phpMyAdmin issue.
Big Note: You really should not be using the root account for any app/website access. Instead you should create a user account in MySQL/mariaDB one for each app/website that has access only to the database(s) required for that app/website. (Basic Security)
There was a user called "Any" hostname "%" which looks to be what was causing the issue, I gave it access to all databases (most likely wrong thing to do but it's internally accessed only - no access outside of our network).
This got rid of the error
Thanks for your help

Authentication plugin error while connecting to MySQL database

I am working on macOS ver 10.13.5 - the newest one actually.
I usually work with Laravel projects (5.6), and so I am using brew services isntaller to make local enviroment working.
I am using PHP v 7.1.16, MySQL 8.0.11 and Valet in v. 2.0.12
PHP and MySQL installed through Brew.
I've been working without any problems for like 3 months in the past, but the day when I had to reinstall my os finally come.
After reinstalling macOS with the fresh copy, and installing each service in the same version as it's been before, I am getting some weird error while trying to connect to the MySQL database through SequelPro.
Here's some logs:
MySQL said: Authentication plugin 'caching_sha2_password' cannot be
loaded: dlopen(/usr/local/lib/plugin/caching_sha2_password.so, 2): image
not found
That's weird, as I've been working with the same stuff without any problems for quite a while...
So I'd appreciate any advices on how to deal with this problem.
Also I'd like to notice that I've read almost everything about this problem, but I wasn't able to find at least one with configuration like mine (most of them described this problem as while working with local database provided by mysql or some other services provider).
The error message appears because MySQL v8 changed the default authentication plugin / method, which has no backwards compatibility with older clients.
The error can be worked around by using the legacy authentication method, which can be enabled for the root user by doing the following:
After installing MySQL, authenticate using the CLI e.g
mysql -uroot
Then run the following command to use the old authentication method:
ALTER USER root#localhost IDENTIFIED WITH mysql_native_password BY 'PASSWORD';
Lastly, flush the privileges:
FLUSH PRIVILEGES;
Now you should able to connect using SequelPro again (using the specified password).

MySQL 8.0.11 error connect to caching_sha2_password the specified module could not be found

I've tried to connect to the latest MySQL server 8.0.11 from MySQL workbench, but the error keeps popping up: Cannot connect to MySQL server, authentication plugin: caching_sha2_password: the specified module could not be found.
I tried looking at MySQL server installation videos online and replicated every step accurately, but the error persists.
Any help is greatly appreciated.
I had the following solution:
change my.ini in a [mysqld] section like this:
#default_authentication_plugin=caching_sha2_password (comment line!)
default_authentication_plugin=mysql_native_password (new line)
Connect to your MySQL under root in a command line client
and execute:
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'xxx';
Where xxx is your current password.
Try to connect your MySQL use terminal, and use this.
mysql > ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';
See:
Changes in MySQL Workbench 8.0.11 (2018-04-19, Release
Candidate)
...
MySQL Workbench now supports the caching_sha2_password authentication plugin introduced in MySQL 8.0 (see Caching SHA-2 Pluggable Authentication). A user account can be reset to use the other available authentication types for making a connection.
...
After poking around I actually found a way to solve it:
During the configuration, when you reach the authentication method choose the Legacy Authentication Method.
It worked for me~!
I was seeing this issue with HeidiSQL, and I found a workaround in the HeidiSQL Github repository:
https://github.com/HeidiSQL/HeidiSQL/issues/163
I fixed by copying libmysql.dll from my last MySql install to my HeidiSQL folder.
If you have just installed mysql server. Run the installer again and it will allow you to reconfigure the options.
On the third sceen it will say
"Use legacy Authentication method"
choose that option
I know it is an old post. This is just to share my experience, hoping it will be useful for someone.
I also faced similar issue.
We can use the portable version of Heidisql. The portable version does not have this issue.
using mysql_native_password is a workaround.
Your client software (MySQL Workbench) does not support the authentication plugin most probably because it is an older version.
https://tableplus.io/blog/2018/07/failed-to-load-caching-sha2-password-authentication-plugin-solved.html
follow the above link.
The actual reason for "caching_sha2_password" is because while installing MySQL under Authentication Method, by default Use Strong Crypted Password radio button is chosen, instead we need to give User Legacy Authentication type password option for password
Run this in MySQL WorkBench:
ALTER USER 'user'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Then further edit the credential and schema to access under the below directory path:
ror_project_path/config/database.yml

Cannot connect Wordpress to MySQL database

Doing some local website work to learn Wordpress theme development.
Tried to set up Wordpress through the prompts, also tried it by manually entering information in the wp-config.php file, neither would work. Still cannot connect to the database, the setup-config.php page returns "Error establishing a database connection". I've double, triple, and quadruple checked the login credentials (database name, username, password etc.), they are complete and correct. Deleted wp-config.php and tried again through the web page, same result.
MySQL is definitely running, the Mac System Preferences panel says so, and I can login and run SQL queries at the command line, although I have to do that as root. Should I be running MySQL as root?
This problem exists with Wordpress and also with an instance of phpMyAdmin that I've also installed, so I don't think it's anything to do with the PHP code as such, it smells more like a permissions thing. For what it's worth, I've edited my httpd.conf file to get Wordpress on port 80 and phpMyAdmin on 8081. Apache is serving those sites up as it should and PHP is running, it's just getting either site to connect to the database that's the problem.
System information:
Mac OS X 10.9.5 (Mavericks)
PHP Version 5.4.30
MySQL version:
mysql Ver 14.12 Distrib 5.0.45, for apple-darwin9.2.0 (i686) using EditLine wrapper
In my case it was as simple as changing the DB_HOST so it was using the correct host and port in wp-config.php:
define('DB_HOST', '127.0.01:3306');
I found the solution on this stackoverflow page.
By default, Apache cannot send requests to a remote MySQL server. It should be enabled.
On CentOS 6 the solution is the command:
setsebool httpd_can_network_connect=1
Check your phpinfo(); to see if MySQL extension for php is installed.
I experienced a similar issue and it turned out that the authentication type used by MYSQL was not supported.
To verify this, add
define('WP_DEBUG', true)
in the wp-config.php and re-run the installation. You will see an entry indicating if that's the case.
If the issue is confirmed to the authentication method, try
mysql> CREATE USER ‘username’#‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’;
after logging in to mysql console.

MySQL Password Not Working

EDIT: I had MySQL installed twice on my machine (XAMPP & on its own)
When I enter my password into MySQL Command Line Client, it rejects my password, gives 1 beep and closes the window. Can anyone provide me with a basic troubleshooting list of steps (from simple to progressively more technical) to regain entry into MySQL once and for all. Also, can anyone tell me what can cause my password to suddenly be rejected? I am also running XAMPP and the MySQL service is both installed and running. Thanks in advance.
I remember when I first got this problem some months ago, if I recall correctly, I solved it by starting the MySQL service from Windows XP's Administrative Tool (something I did stopped the MySQL service and to this day I don't know what it was).
Now the problem has started back again but this time, when I checked Services, the MySQL service was already 'started'.
Any assistance will be appreciated. Thanks
I think I figured out why my password was not working. I had two versions of MySQL installed on my machine (XAMPP and MySQL 5.1). So I deleted the MySQL 5.1 and it worked.
For me (and my similar problem),
--password = mypass
didn't work, but
--password="mypass"
did.
Is there an error message when it rejects your password? I wonder if perhaps you are using an outdated client and running into this issue: http://dev.mysql.com/doc/refman/5.1/en/old-client.html
If you set mySQL to not begin running on startup, then you need to start it prior to attempting to login. This can be done via the command line, via the task manager if you configured it as a windows service, etc.
For example, here is an explanation of starting the service using cmd
Starting MySQL from the Windows Command Line | MySQL
Do you have the password for the root account? If so, try this from the command line?
mysql --user=root --password=your password here
or
mysql --user=root --password=your password here --database=MySQL
A bit too late but - If you have numeric characters in your password and are using the numpad on your keyboard, ensure that the numlock is ON. For some weird reason if you have numlock off MySQL will still interpret a keystroke. This wasn't very obvious to me since my laptop doesn't have a num lock indicator light, thats HP for yah :)
How to Reset the Root Password | MySQL
This is the services solution that was mentioned. Use this if you can't remember your root password.
I'd like to add another successful solution to this problem. I reran the installer (the msi), chose the repair option and everything was fixed.
My password suddenly worked again, so I took the following steps to change it:
Using Windows Command Prompt, navigate to MySQL's bin directory
Type: mysqladmin -uroot -p password yourNewPassword
Press Enter. You will be prompted for your password, enter it
If no error messages/beeps happen, your password was successfully changed
Log in using MySQL Command Prompt with your new password
What I don't understand is that WHY all of a sudden my password started back to work after approximately 24 hours? I wish I know so I can avoid this in the future.