MySQL Python 中的错误 - 无法连接到 MySQL 服务器
MySQL error in Python - cannot connect to MySQL server
我有一个问题:
我的输入:
import mysql.connector
import mysql.connector
mydb = mysql.connector.connect(
host = 'localhost',
user = 'root',
passwd = 'ananthjeahinowiamshowingmypasswordwitchisnotmypassword'
)
print(mydb)
这是输出:
mysql.connector.errors.NotSupportedError: Authentication plugin
'caching_sha2_password' is not supported
安装 Python MySQL 驱动程序:
只需确保根据您的操作系统、MySQL 版本和您使用的 Python 版本安装正确的连接器:
pip install mysql-connector-python
我有一个问题:
我的输入:
import mysql.connector
import mysql.connector
mydb = mysql.connector.connect(
host = 'localhost',
user = 'root',
passwd = 'ananthjeahinowiamshowingmypasswordwitchisnotmypassword'
)
print(mydb)
这是输出:
mysql.connector.errors.NotSupportedError: Authentication plugin
'caching_sha2_password' is not supported
安装 Python MySQL 驱动程序:
只需确保根据您的操作系统、MySQL 版本和您使用的 Python 版本安装正确的连接器:
pip install mysql-connector-python