Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to log in with MySQL 8.0.11; caching_sha2_password authentication method unknown to the client #14220

Closed
ibennetch opened this issue Apr 21, 2018 · 50 comments
Assignees
Labels
documentation waiting on upstream Issues blocked by a third-party
Milestone

Comments

@ibennetch
Copy link
Member

ibennetch commented Apr 21, 2018

With MySQL 8.0.11 I'm unable to log in with users that had been working fine under previous versions (at least 8.0.0, perhaps even more recent than that).

mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]

mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client

See also https://dev.mysql.com/doc/refman/8.0/en/authentication-plugins.html

I'm using QA_4_8.

@ibennetch
Copy link
Member Author

See also https://stackoverflow.com/questions/49948350/phpmyadmin-on-mysql-8-0

@ibennetch
Copy link
Member Author

Possibly related: #14217

@ibennetch ibennetch added this to the 4.8.1 milestone Apr 21, 2018
@ibennetch
Copy link
Member Author

A point release seems like a bad time to make changes to the authentication protocols. I've been testing with 8.0.4-rc which works fine, and now that 8.0.11 is out it causes problems.

@Gemorroj
Copy link
Contributor

https://bugs.php.net/bug.php?id=76243

@ozeer
Copy link

ozeer commented Apr 30, 2018

I met this issue a few days before, is there anyone who solve this problem? thanks a lot~

@ibennetch ibennetch changed the title Unable to log in with MySQL 8.0.11 Unable to log in with MySQL 8.0.11; caching_sha2_password authentication method unknown to the client May 10, 2018
@MauricioFauth
Copy link
Member

There is not much we can do about it right now, as apparently PHP still does not support the caching_sha2_password authentication method.

However, I was able to connect successfully using other authentication methods such as mysql_native_password and sha256_password.

@MauricioFauth
Copy link
Member

PHP developers started adding caching_sha2_password support. Once a version of PHP with this support is released, we can add support for caching_sha2_password on our side as well.

@ibennetch ibennetch modified the milestones: 4.8.2, 4.8.3 Jun 22, 2018
@rmanibus
Copy link

Upgrading to PHP7.2.7 solved the issue for me.

@donpaul120
Copy link

@rmanibus i have php 7.2.7 and mysql Ver 8.0.11 but im wondering why it doesn't work still.

@Apollo725
Copy link

I expired root user and reinstall all of the mysql workspace, then I got this error.
Warning: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in /Volumes/Workspace/workspace/test/php_test/Simple-PHP-Login/add.php on line 3

I was using mac and didn't use xampp.

@ibennetch ibennetch modified the milestones: 4.8.3, 4.8.4 Aug 22, 2018
@ggets
Copy link

ggets commented Oct 20, 2018

php-fpm 7.2.11 and mysql 8.0.12 both on centos 7.5.1804 x64 and not working with phpmyadmin 4.8.3

@MauricioFauth
Copy link
Member

As mentioned earlier, there is not much we can do about it at this time.
The mysqlnd library does not support the caching_sha2_password authentication method yet.
An alternative would be to use the libmysqlclient library, however PHP does not support the libmysqlclient library of MySQL 8 yet.

So the real alternative, for now, is to use another authentication method other than caching_sha2_password.

@SugarD-x
Copy link

I'm not sure if this helps anything, but on MySQL Server 8.0.12, I'm getting this error ONLY when upgrading to PHP 7.2.11. (It doesn't just affect PHPMyAdmin). When I revert back to PHP 7.2.8, I have no problems. Seems a bit odd that a newer version of PHP would cause this.

I know downgrading PHP is probably not the greatest idea, but if this helps anyone as a temporary solution, it is there.

@ibennetch
Copy link
Member Author

@yanickrochon It's odd to me that you'd see the same message repeated so many times. I suggest clearing your phpMyAdmin cookies (they start with 'pma_') or trying with private browsing mode; you can also try with a minimal config.inc.php file and see if that improves the situation. You could try logging in directly as the pma user, to make sure that part works correctly as well.

@wildone
Copy link

wildone commented Dec 12, 2019

docker container still on 7.2 :(

@ibennetch
Copy link
Member Author

ibennetch commented Dec 12, 2019 via email

@SugarD-x
Copy link

From what I'm hearing from multiple sources, this was fixed in PHP 7.4.0, however after upgrading, I'm getting the caching_sha2_password issues again. I'm at a loss as to why PHP and MySQL refuse to communicate through this authentication method, even in a version that supposedly supports it. I can't even get into PHPMyAdmin to see what is going on either. It works fine in PHP 7.2.8, (the last one to support it until 7.4.0).

I'm beginning to think this isn't actually fixed like PHP claims.

@ibennetch
Copy link
Member Author

ibennetch commented Dec 12, 2019 via email

@SugarD-x
Copy link

SugarD-x commented Dec 12, 2019

PHP: 7.4.0
MySQL: Community Server 8.0.18
PHPMyAdmin: 4.9.2

They are all the latest production versions as of this posting. I upgraded everything except PHP and it was still working fine. (I was on PHP 7.2.8 prior to this issue, which was the last version before PHP 7.4.0 to support caching_sha2_password). As soon as I updated PHP, the issues popped up.

I've literally spent hours trying to hunt down the cause to no avail. MySQL's Command Line is reporting that my root account is still using caching_sha2_password properly.

The only reference I can find online of any issues with PHP 7.4.0 and caching_sha2_password was this answer here, under which I fall into the category of point 2, which references "possible issues":
https://stackoverflow.com/a/59239183

Nothing came up as reported on PHP's bug tracker.

phpmyadmincachingsha2passwordloginerror

@SugarD-x
Copy link

Looks like I finally got an answer. It is not officially "fully" supported as of PHP 7.4.0 yet. Looks like I'll have to revert back to PHP 7.2.8 until the next release.

php/php-src@4f06e67#commitcomment-36398518

@SugarD-x
Copy link

Just a quick heads up for everyone, this was not fixed in PHP 7.4.1, as originally planned. I'm still waiting for them to update the tag on the issue too. (They haven't created one for PHP 7.4.2 yet, and PHP 7.4.1 hasn't been listed as released online on the main website either. It is only available on the Windows PHP one right now).

@cplaiu
Copy link

cplaiu commented Dec 18, 2019

PHP 5.4.16
MySQL: Community Server 8.0.18
PHPMyAdmin: 4.4.15.10
Centos: 7

I added default-authentication-plugin=mysql_native_password to the file /etc/my.cfg and use ALTER USER root IDENTIFIED WITH mysql_native_password BY 'PASSWORD'; but still not work.

image

@SugarD-x
Copy link

You need to change "PASSWORD" to the password you want. You just changed your root password literally to "PASSWORD" without the quotes if you used that command as is.

@ibennetch
Copy link
Member Author

ibennetch commented Dec 18, 2019 via email

@cplaiu
Copy link

cplaiu commented Dec 18, 2019

You need to change "PASSWORD" to the password you want. You just changed your root password literally to "PASSWORD" without the quotes if you used that command as is.

It's what I do.

ALTER USER root@'localhost' IDENTIFIED WITH mysql_native_password BY 'mypassword';

cplaiu That is a generic error message that doesn’t apply to this specific solution. Are you sure the MySQL server process is running? Can you connect from the command line client? Perhaps try changing between host “localhost” and “127.0.0.1” in config.inc.php (in case your user has access through one connection type but not the other).

Yes I'm sure that mysql process is running, because I can connect from the CLI. I try to change “localhost” to 127.0.0.1”.

netstat -atnlp|grep -i "3306|mysql" returns:

tcp6 0 0 :::33060 :::* LISTEN 27697/mysqld
tcp6 0 0 :::3306 :::* LISTEN 27697/mysqld

I try to bind-address=0.0.0.0 in /etc/my.cfg

But still not working.

@williamdes williamdes modified the milestones: 4.9.3, 5.0.0, 5.0.1 Dec 26, 2019
@ibennetch ibennetch modified the milestones: 5.0.1, 5.0.2 Jan 8, 2020
@ibennetch ibennetch self-assigned this Jan 8, 2020
@ibennetch ibennetch modified the milestones: 5.0.2, 5.0.1 Jan 8, 2020
@ibennetch
Copy link
Member Author

We've added a FAQ about this (1ae14b5), and since this isn't a bug with phpMyAdmin I'm going to suggest we close this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation waiting on upstream Issues blocked by a third-party
Projects
None yet
Development

No branches or pull requests