pymysql.err.OperationalError: (1130, “host.docker.internal’ is not allowed to connect to this MySQL server”)![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/16199ca200abb491994e7f942242751c.png)
- 然后运行一下这两行代码即可
1. update user set Host='%' where User='root';
2. flush privileges;
python连接数据库报错“:RuntimeError: ‘cryptography’ package is required for sha256_password or caching_sha2_password auth methods
该错误提示的意思是:sha256_password和caching_sha2_password两种加密方式需要cryptography。
所以只需要安装一下cryptography包就可以了: pip install cryptography
或者豆瓣源:pip3 install cryptography -i https://pypi.douban.com/simple
(推荐)清华大学源:pip3 install cryptography -i https://pypi.tuna.tsinghua.edu.cn/simple