MySQLdb.OperationalError: (2059, "Authentication plugin 'mysql_native_password' cannot be loaded) #769
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
import MySQLdb
conn = MySQLdb.connect(
host="xxxx", # MySQL 地址
port=xxx, # MySQL 端口
user="xxxx", # 用户名
passwd="xxxx", # 密码
db="xxxx", # 数据库名
charset="xxxxx" # 编码
)
2️⃣ 创建游标
cursor = conn.cursor()
Executing the code resulted in an error.
File "/opt/miniconda3/envs/lib/python3.13/site-packages/MySQLdb/init.py", line 121, in Connect
return Connection(*args, **kwargs)
File "/opt/miniconda3/envs/lib/python3.13/site-packages/MySQLdb/connections.py", line 193, in init
super().init(*args, **kwargs2)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
MySQLdb.OperationalError: (2059, "Authentication plugin 'mysql_native_password' cannot be loaded: dlopen(/opt/miniconda3/envs/lib/plugin/mysql_native_password.so, 0x0002): tried: '/opt/miniconda3/envslib/plugin/mysql_native_password.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/miniconda3/envs/lib/plugin/mysql_native_password.so' (no such file), '/opt/miniconda3/envs/lib/plugin/mysql_native_password.so' (no such file)")
But the same code in python 3.10 and python 3.12 does not throw the error.
Environment
python version: 3.13
mysqlclient: 2.2.7
os: mac
mysql: 8.0
How did you install libmysqlclient libraries?
brew install mysqlclient
What version of mysqlclient do you use?
2.2.7
Docker command to start MySQL server
No response
Minimum but complete code to reproduce
Schema and initial data required to reproduce.
Commands, and any other step required to reproduce your issue.
No response
Beta Was this translation helpful? Give feedback.
All reactions