Page 1 of 1

mysqldb , where is it for Centos08

Posted: 2020/06/29 11:50:46
by sqlservermcp
I am using python programs on a few ubuntu machines that connect to various mysql databases, all working fine using mysqldb in the python script. As i am learning linux with a view to getting some certification i have installed CentOS8 on a machine to gain more linux coverage, and have everything working that i have on my ubuntu machines except python scripts requiring mysqldb.

I have tried multiple combinations to try to install mysqldb and all fail

sudo yum install mysql-python
sudo yum install mysql-python3
sudo yum install python-mysql
sudo yum install python3-mysql

and the same using mysqldb and also tried pip install as well

How and where do i get mysqldb for centos8. On ubuntu i used sudo apt install python-mysqldb

If i can't figure this out it means I can't run any of my scripts.

I have Python 3.6 running and mysql is installed and the service running

Thanks

Re: mysqldb , where is it for Centos08

Posted: 2020/06/29 12:58:39
by TrevorH
[root@centos8 ~]# dnf list \*python\* | grep -i mysql
python-mysqlclient-doc.x86_64 1.4.6-2.el8 epel-testing
python2-PyMySQL.noarch 0.8.0-10.module_el8.2.0+381+9a5b3c3b AppStream
python3-PyMySQL.noarch 0.8.0-10.module_el8.1.0+245+c39af44f AppStream
python3-aiomysql.noarch 0.0.20-2.epel8.playground epel-playground
python3-mysqlclient.x86_64 1.4.6-2.el8 epel-testing
python38-PyMySQL.noarch 0.9.3-3.module_el8.2.0+317+61fa6e7d AppStream

Re: mysqldb , where is it for Centos08

Posted: 2020/06/29 17:18:04
by sqlservermcp
Thanks TrevorH

I ran that and i can see PyMySQL stuff but what i need is the MySQLdb python class otherwise i would have to change all my Python scripts to use another connector when they all work on Ubuntu and Raspbian.

I want to be able in python3 to have

import MySQLdb

It is this i want to know how/where to install as nothing i have tried seems to work to install it

Re: mysqldb , where is it for Centos08

Posted: 2020/06/29 17:55:20
by TrevorH

Code: Select all

[root@centos8 ~]# dnf provides '*/MySQLdb/__init__.py'
Last metadata expiration check: 1:25:39 ago on Mon Jun 29 17:29:18 2020.
python3-mysqlclient-1.4.6-2.el8.x86_64 : MySQL/mariaDB database connector for Python
Repo        : epel-testing
Matched from:
Filename    : /usr/lib64/python3.6/site-packages/MySQLdb/__init__.py

Re: mysqldb , where is it for Centos08

Posted: 2020/06/29 18:16:34
by sqlservermcp
HI TrevorH

I have ran the dnf provides '*/MySQLdb/__init__.py'

I get No matches found.

I have tried

dnf install python3-mysqlclient and

yum install python3-mysqlclient

and get Unable to find match,

I thought i could just install with similar to those commands above

Re: mysqldb , where is it for Centos08

Posted: 2020/06/29 18:44:29
by TrevorH
It's in the third party yum repo, EPEL. Run yum install epel-release. My copy listed there came from epel-testing which will be available but disabled after that install command,

Re: mysqldb , where is it for Centos08

Posted: 2020/06/29 19:44:01
by sqlservermcp
Thanks for your help so far Trevor,

I checked and i already have epel-release repo installed and i still can't find mysqldb or myssqlclient.

I am new to Linux so am getting lost off with this now as all i had to do on Rasp Pi was one command and it just worked on all my Pi and 3 Ubuntu machines.

If anyone has actually wrote a python script on centos08 using mysqldb , how did you install mysqldb?

Re: mysqldb , where is it for Centos08

Posted: 2020/06/29 19:46:14
by TrevorH
dnf --enablerepo=epel-testing install python3-mysqlclient

Re: mysqldb , where is it for Centos08

Posted: 2020/06/30 17:18:45
by sqlservermcp
Thanks TrevorH

That worked. I can now use import MySQLdb in python. Failing that one of your previous posts mentioned pymysql , i have also got that working on python code in both CentOS and Ubuntu and Raspbian.