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

数据库 admin 5个月前 (11-18) 423次浏览 已收录 0个评论 扫描二维码

mysql 安装了最新版本8.0.12后创建用户并授权后,Phpmyadmin登陆的时候,提示

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

查阅一些相关的资料后发现是由于新版本的mysql账号密码解锁机制不一致导致的

解决办法:

删除创建的用户和授权

方法(实测)

mysql -uroot -p

use mysql; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';

操作如下:

mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 8.0.12 Homebrew

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ”;
Query OK, 0 rows affected (0.09 sec)

mysql> exit
Bye

 


少将博客 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:mysqli_real_connect(): The server requested authentication method unknown to the client
喜欢 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址