Pycharm查询表,连接MySQL报错:RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods


通过pycharm链接mysql数据库时,查询表报错提示:

RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods

 

方法1:重启MySQL

① 以管理员身份,cmd中输入命令行“net start MySQL80”(根据安装的版本,MySQL80这里服务名称不一样),来启动mysql

② 输入 “mysql”,进入MySQL。

 

 ③ pycharm再次运行,不报错了。

 

方法2:安装cryptography包

报错:RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods

该错误提示的意思是:sha256_password和caching_sha2_password两种加密方式需要cryptography。

所以只需要安装一下cryptography包就可以了: pip install cryptography

① 首先,前提在任务管理器中,看到mysql是运行的。

② 打开cmd后,输入命令“pip install cryptography”,安装成功后,再次运行pycharm,不报错了。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM