Installing Python MySQLdb

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

If it throws ImportError  like this

check mysqldb installation

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 the steps we need to take to access database.

Leave a Reply

Be the First to Comment!

Notify of
avatar

wpDiscuz