I was trying to set up a mysql connection with php using PDO.
(我试图使用PDO与php建立mysql连接。)
Here are the version of the software I use :
(这是我使用的软件版本:)
- windows 7 64
(的Windows 7 64)
- mysql 8.0.18
(的MySQL 8.0.18)
- php 7.3.11
(的PHP 7.3.11)
And suddenly, the php server shows this error message :
(突然,PHP服务器显示此错误消息:)
Erreur : SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
(错误:SQLSTATE [HY000] [2054]服务器请求客户端未知的身份验证方法)
It took me a long time to figure out what was happening.
(我花了很长时间才弄清楚发生了什么。)
This is the solution i've found : : (这是我发现的解决方案::)
CREATE USER 'your_user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password';
mysql_native_password is the old authentification method to use instead of the new one who cause the error.
(mysql_native_password是一种旧的身份验证方法,而不是导致错误的新方法。)
I couldn't answer to the other post because of my 'reputation' on Stackoverflows, so I created my own post.
(由于在Stackoverflows上的“声誉”,我无法回答其他帖子,因此我创建了自己的帖子。)
If you're unable to load the PDO driver on windows, try this :
(如果您无法在Windows上加载PDO驱动程序,请尝试以下操作:)
extension_dir = "C:\BAK\php_7.3.11\ext"
ask by Mickael HUMPHREYS translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…