Unable to log in with MySQL 8.0.11; caching_sha2_password authentication method unknown to the client
ibennetch opened this issue · comments
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.
Possibly related: #14217
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.
I met this issue a few days before, is there anyone who solve this problem? thanks a lot~
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
.
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.
Upgrading to PHP7.2.7 solved the issue for me.
@rmanibus i have php 7.2.7 and mysql Ver 8.0.11 but im wondering why it doesn't work still.
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.
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
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
.
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.
@SugarD-x This is related to commit php/php-src@d6e81f0 which was later reverted by php/php-src@03740ef.
@MauricioFauth Thank you! That definitely explains my issue.
I used this to get it back when I started a new dev server with mysql 8 and php 7.3
ALTER USER root@localhost IDENTIFIED WITH mysql_native_password BY 'PASSWORD';
it seems to be working ok so far.
@doveraudio That is the workaround, not an actual fix. That just updates your root database login to use the old password authentication method, rather than this new one.
https://stackoverflow.com/questions/49948350/phpmyadmin-on-mysql-8-0
I was able to connect successfully using other authentication methods such as mysql_native_password
By running this command on mysql on the terminal.
cd /usr/local/mysql/bin
./mysql -u root -p
Run command below on msql terminal
CREATE USER sky@localhost IDENTIFIED WITH mysql_native_password BY 'password'
As I just said previously:
That is the workaround, not an actual fix. That just updates your root database login to use the old password authentication method, rather than this new one.
doveraudio's suggestion worked for me as well. I'm using php7.3, caching_sha2 still not working there either I guess, hopefully they are working on it.
https://stackoverflow.com/questions/49948350/phpmyadmin-on-mysql-8-0
I was able to connect successfully using other authentication methods such as
mysql_native_password
By running this command on mysql on the terminal.
cd /usr/local/mysql/bin
./mysql -u root -p
Run command below on msql terminal
CREATE USER sky@localhost IDENTIFIED WITH mysql_native_password BY 'password'
Works for me as well, thanks @p8ul
The caching_sha2_password
authentication method will only be supported in PHP 7.4+ due to the hard dependency on ext/hash. See php/php-src@4f06e67.
The built-in PHP version in MacOS mojave is PHP 7.1.23 (I installed mysql Ver 8.0.15 )
So what's the current preferred way to run phpMyAdmin?
You'll have to use the workaround for mysql_native_password in the mean time.
The built-in PHP version in MacOS mojave is PHP 7.1.23 (I installed mysql Ver 8.0.15 )
So what's the current preferred way to run phpMyAdmin?
@antonioaltamura you can run phpmyadmin on MacOS via Docker
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'rootpassword';
login through command line, it works after that
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'rootpassword';
login through command line, it works after that
That is only a workaround, and has been said on here a few times now. It is not an actual fix to the issue.
Has this been fixed?
Has this been fixed?
From my understanding, it is waiting on PHP 7.4.0 to be released, as it is an issue on their end.
A note from the PHP documentation:
When running a PHP version before 7.1.16, or PHP 7.2 before 7.2.4, set MySQL 8 Server's default password plugin to mysql_native_password or else you will see errors similar to The server requested authentication method unknown to the client [caching_sha2_password] even when caching_sha2_password is not used.
This is because MySQL 8 defaults to caching_sha2_password, a plugin that is not recognized by the older PHP (mysqlnd) releases. Instead, change it by setting default_authentication_plugin=mysql_native_password in
my.cnf
. The caching_sha2_password plugin will be supported in a future PHP release. In the meantime, the mysql_xdevapi extension does support it.
im trying to login phpmyadmin with xampp for the first time and i keep getting this:
https://imgur.com/CmxPcSR
Cannot log in to the MySQL server
mysqli_real_connect(): The server requested authentication method unknown to the client [sha256_password]
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client
Connection for controluser as defined in your configuration failed.
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
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
Connection for controluser as defined in your configuration failed.
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
i changed the method to mysql_native_password and it worked then i also checked config.db.php and renewed the old variables(username and password).
That is still a temporary workaround, not a long-term solution. Once the appropriate version of PHP comes out that resolves this problem, it won't be an issue anymore.
I do not understand this issue. My setup can connect just fine to MySQL 8 using caching_sha2_password
, and so does phpMyAdmin to perform queries, etc. Yet, this annoying block of errors pops up :
Both the pma
and my app's credential use the mysql_native_password
method, and my app connects just fine.
I don't get it.
I believe this has been resolved with the release of PHP 7.4; affected users will need to upgrade their PHP installations to take advantage of the upgraded support in the PHP library.
I think we should close this issue now that PHP 7.4 is available.
@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.
docker container still on 7.2 :(
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.
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.
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.
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).
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.
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.
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.