Installing Python MySQLdb

Updated on Jan 07, 2020


MySQLdb is an api for accessing MySQL database using python. It is built on top of MySQL C API.

MySQLdb don't yet have support for python 3, it supports only python 2.4 - 2.7 . As a result you need to use python 2 for this tutorial. We will be using python 2.7.9, which you can download from here.

Installing MySQLdb #


Before installing you must first check whether MySQLdb is already installed on your system. To test open command prompt or terminal, then start python shell and type the following code

import MySQLdb

If it throws ImportError like this:

check-mysqldb-installation.png

then you need to install MySQLdb. Otherwise, you have MySQLdb installed.

If you are on windows download the MySQLdb from here and install it.

In the next post we will discuss how to connect to the access database.


Other Tutorials (Sponsors)