I want to install MySQL on my Ubuntu 20.10 desktop, but I'm facing issues.
I tried installing python3-dev and libmysqlclient-dev.
When running:
pip3 install mysqlclientI keep getting the error below:
How may I solve this?
14 Answers
Check this thread, maybe it helps you.
Error installing libmysqlclient-dev on Ubuntu 20.04
Step 0: sudo apt install python3-dev build-essential
Step 1: sudo apt install libssl1.1
Step 2: sudo apt install libssl1.1=1.1.1f-1ubuntu2
Step 3: sudo apt install libssl-dev
Step 4: sudo apt install libmysqlclient-dev
Step 5: pip3 install mysqlclient
That's it!
ps: To find out these all steps, I was spent almost 4-5 Hours. :D
1As mentioned here you should do:
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
Debian / Ubuntusudo yum install python3-devel mysql-devel
Red Hat / CentOS
After that just do pip install mysqlclient
This can usually be resolved with the libffi-dev libraries; libffi.so specifically. It can be installed via apt with:
sudo apt install libffi-devNote: I have not found a way to install this via pip3. Do let me know if you find it somewhere.
Once libffi-dev is installed, run ldconfig to load the new .so.
Important: If you compiled your own Python installation, then you will need to recompile it for libffi-dev to be loaded.
If you are having trouble while setting up virtual environment then do mention python version:
sudo apt-get install python3.5-dev
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
sudo apt-get install libssl-dev