python - 为什么在建立 mysql 到 python 连接时出现错误?
问题描述
当我在 Python 中连接 db 时出现错误:
mysql.connector.errors.NotSupportedError:不支持身份验证插件“caching_sha2_password”
代码:
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="prakash17"
)
print(mydb)
解决方案
此处已对此进行了回答: 不支持身份验证插件'caching_sha2_password'
解决方案是安装 mysql-connector-python 而不是 mysql-connector:
pip install mysql-connector-python
推荐阅读
- markdown - Markdown:引用另一个文件中的部分
- java - Sanitizer - Spring Boot CSRF 令牌验证响应
- android - 如何将应用栏中的资产图像添加为 Flutter 应用程序中的操作图标?
- python - 为什么这个keras网络不“学习”?
- javascript - 如何在移动设备上制作 Wordpress 图像缩放?
- sql - SQL-如何将 YYYYMM 数字转换为日期
- robotics - ROS2和DDS有什么区别?
- javascript - 多选 Jquery 插件问题
- javascript - Angular2中嵌套多个组件之间的通信
- c++ - C++ 将函数对象作为左值和/或右值传递