An exception occurred in driver: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
php 连接 mysql 8.0
只 用户设置就行
create user 'user'@'ip' identified by 'pwd';
grant all privileges on 库名.* to 'user'@'ip';
ALTER USER 'user'@'ip' IDENTIFIED WITH mysql_native_password BY 'pwd';
flush privileges;
其他辅助命令:
密码长度设置
set global validate_password_policy=LOW;
set global validate_password.policy=0;
set global validate_password.length=1;
删除用户
DROP USER 'user'@'host';
查看所有用户
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;