BLOG HOW TO RANDOM-HOWTO'S

Fix mysql client installation while working on Django

Problem: When you are trying to connect django with mysql things break for no reason, like the mysql client fails to install through "pip install mysqlclient"

 

Solution: on the django side

  • first you need to deactivate from the python environment: to do that just type "deactivate"
  • then u should be on # or $ command line, then you need to install this package  libmysqlclient-dev

 

sudo apt-get install libmysqlclient-dev -y
[sudo] password for userm: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libfwupdplugin1
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  libmysqlclient21
The following NEW packages will be installed:
  libmysqlclient-dev
The following packages will be upgraded:
  libmysqlclient21
1 upgraded, 1 newly installed, 0 to remove and 56 not upgraded.
Need to get 1,660 kB/2,986 kB of archives.
After this operation, 10.3 MB of additional disk space will be used.
Get:1 http://et.archive.ubuntu.com/ubuntu focal-updates/main amd64 libmysqlclient-dev amd64 8.0.31-0ubuntu0.20.04.1 [1,660 kB]
Fetched 1,660 kB in 2s (1,055 kB/s)             
(Reading database ... 193972 files and directories currently installed.)
Preparing to unpack .../libmysqlclient21_8.0.31-0ubuntu0.20.04.1_amd64.deb ...
Unpacking libmysqlclient21:amd64 (8.0.31-0ubuntu0.20.04.1) over (8.0.30-0ubuntu0.20.04.2) ...
Selecting previously unselected package libmysqlclient-dev.
Preparing to unpack .../libmysqlclient-dev_8.0.31-0ubuntu0.20.04.1_amd64.deb ...
Unpacking libmysqlclient-dev (8.0.31-0ubuntu0.20.04.1) ...
Setting up libmysqlclient21:amd64 (8.0.31-0ubuntu0.20.04.1) ...
Setting up libmysqlclient-dev (8.0.31-0ubuntu0.20.04.1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...

After doing this you need to add new mysql user on the phpmyadmin or the mysql admin area like this
then simply type this on the python environment.

biniesh
I am and Ethiopian Blogger and computer Enthusiast.
http://www.binishare.com/wp

Leave a Reply

Your email address will not be published. Required fields are marked *

89 − 79 =