mysqli_real_connect(): The server requested authentication method unknown to the client | 少将全栈
  • 欢迎访问少将全栈,学会感恩,乐于付出,珍惜缘份,成就彼此、推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 吐槽,投稿,删稿,交个朋友
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏少将全栈吧

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

数据库 admin 6年前 (2018-11-18) 8450次浏览 已收录 扫描二维码

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

 

喜欢 (3)
[🍬谢谢你请我吃糖果🍬🍬~]
分享 (0)
关于作者:
少将,关注Web全栈开发、项目管理,持续不断的学习、努力成为一个更棒的开发,做最好的自己,让世界因你不同。