(Sponsors) Get started learning Python with DataCamp's free Intro to Python tutorial. Learn Data Science by completing interactive coding challenges and watching videos by expert instructors. Start Now!
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
If it throws
ImportError like this:
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)
This site generously supported by DataCamp. DataCamp offers online interactive Python Tutorials for Data Science. Join over a million other learners and get started learning Python for data science today!