mysqldb , where is it for Centos08

Issues related to applications and software problems and general support
Post Reply
sqlservermcp
Posts: 5
Joined: 2020/06/29 11:43:08

mysqldb , where is it for Centos08

Post by sqlservermcp » 2020/06/29 11:50:46

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

User avatar
TrevorH
Forum Moderator
Posts: 29172
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: mysqldb , where is it for Centos08

Post by TrevorH » 2020/06/29 12:58:39

[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
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

sqlservermcp
Posts: 5
Joined: 2020/06/29 11:43:08

Re: mysqldb , where is it for Centos08

Post by sqlservermcp » 2020/06/29 17:18:04

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

User avatar
TrevorH
Forum Moderator
Posts: 29172
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: mysqldb , where is it for Centos08

Post by TrevorH » 2020/06/29 17:55:20

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
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

sqlservermcp
Posts: 5
Joined: 2020/06/29 11:43:08

Re: mysqldb , where is it for Centos08

Post by sqlservermcp » 2020/06/29 18:16:34

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

User avatar
TrevorH
Forum Moderator
Posts: 29172
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: mysqldb , where is it for Centos08

Post by TrevorH » 2020/06/29 18:44:29

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,
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

sqlservermcp
Posts: 5
Joined: 2020/06/29 11:43:08

Re: mysqldb , where is it for Centos08

Post by sqlservermcp » 2020/06/29 19:44:01

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?

User avatar
TrevorH
Forum Moderator
Posts: 29172
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: mysqldb , where is it for Centos08

Post by TrevorH » 2020/06/29 19:46:14

dnf --enablerepo=epel-testing install python3-mysqlclient
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

sqlservermcp
Posts: 5
Joined: 2020/06/29 11:43:08

Re: mysqldb , where is it for Centos08

Post by sqlservermcp » 2020/06/30 17:18:45

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.

Post Reply

Return to “CentOS 8 - General Support”