How To Install python3-mysql on Rocky Linux 8

In this tutorial we learn how to install python3-mysql on Rocky Linux 8. python3-mysql is An interface to MySQL

Introduction

In this tutorial we learn how to install python3-mysql on Rocky Linux 8.

What is python3-mysql

Python interface to MySQL MySQLdb is an interface to the popular MySQL database server for Python. The design goals are - Compliance with Python database API version 2.0 - Thread-safety - Thread-friendliness (threads will not block each other)

We can use yum or dnf to install python3-mysql on Rocky Linux 8. In this tutorial we discuss both methods but you only need to choose one of method to install python3-mysql.

Install python3-mysql on Rocky Linux 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

After updating yum database, We can install python3-mysql using dnf by running the following command:

sudo dnf -y install python3-mysql

Install python3-mysql on Rocky Linux 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

After updating yum database, We can install python3-mysql using yum by running the following command:

sudo yum -y install python3-mysql

How To Uninstall python3-mysql on Rocky Linux 8

To uninstall only the python3-mysql package we can use the following command:

sudo dnf remove python3-mysql

python3-mysql Package Contents on Rocky Linux 8

/usr/lib/.build-id
/usr/lib/.build-id/dd
/usr/lib/.build-id/dd/ad5394188982ba2e3c3724e76e6394aabe31a6
/usr/lib64/python3.6/site-packages/MySQLdb
/usr/lib64/python3.6/site-packages/MySQLdb/__init__.py
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/__init__.cpython-36.opt-1.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/__init__.cpython-36.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/_exceptions.cpython-36.opt-1.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/_exceptions.cpython-36.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/compat.cpython-36.opt-1.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/compat.cpython-36.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/connections.cpython-36.opt-1.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/connections.cpython-36.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/converters.cpython-36.opt-1.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/converters.cpython-36.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/cursors.cpython-36.opt-1.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/cursors.cpython-36.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/release.cpython-36.opt-1.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/release.cpython-36.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/times.cpython-36.opt-1.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/__pycache__/times.cpython-36.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/_exceptions.py
/usr/lib64/python3.6/site-packages/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so
/usr/lib64/python3.6/site-packages/MySQLdb/compat.py
/usr/lib64/python3.6/site-packages/MySQLdb/connections.py
/usr/lib64/python3.6/site-packages/MySQLdb/constants
/usr/lib64/python3.6/site-packages/MySQLdb/constants/CLIENT.py
/usr/lib64/python3.6/site-packages/MySQLdb/constants/CR.py
/usr/lib64/python3.6/site-packages/MySQLdb/constants/ER.py
/usr/lib64/python3.6/site-packages/MySQLdb/constants/FIELD_TYPE.py
/usr/lib64/python3.6/site-packages/MySQLdb/constants/FLAG.py
/usr/lib64/python3.6/site-packages/MySQLdb/constants/__init__.py
/usr/lib64/python3.6/site-packages/MySQLdb/constants/__pycache__
/usr/lib64/python3.6/site-packages/MySQLdb/constants/__pycache__/CLIENT.cpython-36.opt-1.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/constants/__pycache__/CLIENT.cpython-36.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/constants/__pycache__/CR.cpython-36.opt-1.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/constants/__pycache__/CR.cpython-36.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/constants/__pycache__/ER.cpython-36.opt-1.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/constants/__pycache__/ER.cpython-36.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/constants/__pycache__/FIELD_TYPE.cpython-36.opt-1.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/constants/__pycache__/FIELD_TYPE.cpython-36.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/constants/__pycache__/FLAG.cpython-36.opt-1.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/constants/__pycache__/FLAG.cpython-36.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/constants/__pycache__/__init__.cpython-36.opt-1.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/constants/__pycache__/__init__.cpython-36.pyc
/usr/lib64/python3.6/site-packages/MySQLdb/converters.py
/usr/lib64/python3.6/site-packages/MySQLdb/cursors.py
/usr/lib64/python3.6/site-packages/MySQLdb/release.py
/usr/lib64/python3.6/site-packages/MySQLdb/times.py
/usr/lib64/python3.6/site-packages/mysqlclient-1.4.6-py3.6.egg-info
/usr/lib64/python3.6/site-packages/mysqlclient-1.4.6-py3.6.egg-info/PKG-INFO
/usr/lib64/python3.6/site-packages/mysqlclient-1.4.6-py3.6.egg-info/SOURCES.txt
/usr/lib64/python3.6/site-packages/mysqlclient-1.4.6-py3.6.egg-info/dependency_links.txt
/usr/lib64/python3.6/site-packages/mysqlclient-1.4.6-py3.6.egg-info/top_level.txt
/usr/share/doc/python3-mysql
/usr/share/doc/python3-mysql/FAQ.rst
/usr/share/doc/python3-mysql/MySQLdb.constants.rst
/usr/share/doc/python3-mysql/MySQLdb.rst
/usr/share/doc/python3-mysql/README.md
/usr/share/doc/python3-mysql/conf.py
/usr/share/doc/python3-mysql/index.rst
/usr/share/doc/python3-mysql/user_guide.rst
/usr/share/licenses/python3-mysql
/usr/share/licenses/python3-mysql/LICENSE

References

Summary

In this tutorial we learn how to install python3-mysql on Rocky Linux 8 using yum and dnf.