How I loaded caching_sha2_password mysql plugin on Conda
problem
I had to connect to MySQL with caching_sha2_password plugin on Django and Flask. Those were installed on Conda. But when it was being connected I got this error:2059, "Authentication plugin 'caching_sha2_password' cannot be loaded: miniconda3/envs/myenv/lib/plugin/caching_sha2_
password.so
: cannot open shared object file: No such file or directory"
I had no error without Conda, but I had to use Conda because I needed python 3.8 for some old packages. What was installed on Ubuntu 22.04 was Python 3.10.
Solution
At first, activate your env on Conda:
#conda activate myenv
Based on my wide research over many days! I uninstalled mysqlclient (important step):
#pip uninstall mysqlclient
then, I installed pymysql
:
#pip install wheel
#pip install pymysql
For Django, I imported pymysql in the Django project's setting file:
import pymysql
pymysql.install_as_MySQLdb()
For the Flask project, I installed PyMySQL in this way (This one's important too):
#python3 -m pip install PyMySQL[rsa]
Finally, I connected!
Doing these steps saved me. :)
Subscribe to my newsletter
Read articles from Mary directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by