On centos 7.5 I have mysql 5.7.24 installed, with subsequent installation of mysql-devel.
I'm trying to get the MySQLdb module of Python 3.7 working, however, on importing it with (in python)
import MySQLdb
I get the following error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/anaconda3/lib/python3.7/site-packages/MySQLdb/__init__.py", line
18, in <module>
import _mysql
ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory
I checked for libmysqlclient.so.18 on my server with
locate libmysql
I get the following result
/usr/lib64/mysql/libmysqlclient.a
/usr/lib64/mysql/libmysqlclient.so
/usr/lib64/mysql/libmysqlclient.so.20
/usr/lib64/mysql/libmysqlclient.so.20.3.11
/usr/lib64/mysql/libmysqlservices.a
So apparently libmysqlclient.so.18 is missing.
There was a suggestion in this thread to use yum install mariadb-libs but mariadb-libs (saying that .so.18 is there) but that install attempt results in
Package 1:mariadb-server-5.5.60-1.el7_5.x86_64 is obsoleted by mysql-
community-server-5.7.24-1.el7.x86_64 which is already installed
Nothing to do
Can anyone please suggest a fix on how to handle the missing libmysqlclient.so.18 ?
Best Answer
Find and install a package that provides
libmysqlclient.so.18
On your system it may be different.