How To Install MySQL-python on CentOS 7

In this tutorial we learn how to install MySQL-python on CentOS 7. MySQL-python is An interface to MySQL

Introduction

In this tutorial we learn how to install MySQL-python on CentOS 7.

What is MySQL-python

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) - Compatibility with MySQL 3.23 and up This module should be mostly compatible with an older interface written by Joe Skinner and others. However, the older version is a) not thread-friendly, b) written for MySQL 3.21, c) apparently not actively maintained. No code from that version is used in MySQLdb.

We can use yum or dnf to install MySQL-python on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install MySQL-python.

Install MySQL-python on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

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

sudo yum -y install MySQL-python

Install MySQL-python on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

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

sudo dnf -y install MySQL-python

How To Uninstall MySQL-python on CentOS 7

To uninstall only the MySQL-python package we can use the following command:

sudo dnf remove MySQL-python

References

Summary

In this tutorial we learn how to install MySQL-python on CentOS 7 using yum and dnf.