全新的MySQL8.0正式发布后,第一时间尝鲜的在实用phpmyadmin的时候估计会碰到下面两种错误提示。

错误#2054

#2054 - The server requested authentication method unknown to the client
mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client


这个登陆时候就会碰到,因为新的MySQL 8.0.11默认使用的是caching_sha2_password身份验证方法。

解决办法

方法1:修改默认加密方式mysql_native_password

[mysqld]
default_authentication_plugin=mysql_native_password

方法2:修改登陆不上账号的加密方式

ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则 
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码 
FLUSH PRIVILEGES; #刷新权限 

错误 #1064

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0
MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_' at line 1

解决办法

既然phpmyadmin不能用就通过终端登陆执行命令添加

CREATE USER 'aaa'@'%' IDENTIFIED WITH mysql_native_password AS '***' REQUIRE NONE WITH #创建用户
MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; GRANT USAGE ON *.* TO 'aaa'@'%' #授权
最后修改:2018 年 05 月 09 日 01 : 25 PM