Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure doctrine (Symfony 4) to connect with MySQL 8.0?

I got this error:

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

I know that MySQL changed their authentication method in version 8, but how should I update to the latest driver and connect with it in doctrine (Symfony 4)?

like image 898
yifei3212 Avatar asked Jul 24 '18 02:07

yifei3212


Video Answer


1 Answers

The answer of 黃皓哲 on this post helped me out: php mysqli_connect: authentication method unknown to the client [caching_sha2_password]

What it says is that the authentication system has changed on the last versions of MySQL, so when you install it it might ask you to chose if you want to use the old system or the new one, if you chose the new one you need to specify for the moment that the user for Doctrine has to use the old system. To do so you need to do the following:

ALTER USER 'mysqlUsername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysqlUsernamePassword';
like image 103
No_or_yes Avatar answered Sep 23 '22 01:09

No_or_yes