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