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,不报错了。