5

Environment

  • Microsoft Windows 10.0.16299.15
  • PHP 7.2.11
  • MySQL Community Server 8.0.13
  • Symfony 4

I try to connect to MySQL database. When I

php bin/console doctrine:database:create

, I have this:

An exception occurred in driver: SQLSTATE[HY000][2054] The server requested authentication method unknown to the client

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

Community
  • 1
  • 1
Phil31971
  • 53
  • 1
  • 2
  • 3
  • Possible duplicate of [PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client](https://stackoverflow.com/questions/52364415/php-with-mysql-8-0-error-the-server-requested-authentication-method-unknown-to) – Machavity Jun 17 '19 at 12:41

2 Answers2

1

You may check Upgrading to MySQL 8.0 : Default Authentication Plugin Considerations to get information about important notes on upgrading to 8.0 where you will find:

At the time of writing this post, following connectors do not have support for caching_sha2_password.

If you want to know more, you may check caching_sha2_password as the Preferred Authentication Plugin on MySQL official documentation.

So, I think that's soon to upgrade to MySQL 8.0 and you may consider downgrade or wait some time for php mysql extension to be upgraded as well.

Community
  • 1
  • 1
Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
  • 1
    i have reconfigure in "authentification method" and "use legacy authentification method (retain mysql (X. compatibility)" – Phil31971 Nov 22 '18 at 10:29
  • This method seemed not to function for me (although it should for what I understand). So I had to reinstall the MySQL server via the Oracle installer and check the "use legacy authentication method" (like @Phil31971 I suppose). – moudug Jan 30 '20 at 15:02
0

I think you are using MySQL 8, the default method of authentication has changed, maybe you will need to change something in your server configuration.

Look this link: https://github.com/laradock/laradock/issues/1392#issuecomment-368308494

Another thing you can do is downgrade your MySQL version.