Python连接MySQL8报错解决方法


Python连接MySQL8报错,mysql报错RuntimeError: cryptography is required for sha256_password or caching_sha2_p

解决方法:

1). ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则 

2).ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码 

3).FLUSH PRIVILEGES; #刷新权限

4).再重置下密码:alter user 'root'@'localhost' identified by '123456';

5)重启MySQL服务