Friday, October 14, 2016

Getting mySQL to use in Python (on Fedora)

In a project I am working on, we need a database, and we have chosen mySQL.

Python has a standard API for database interaction, the DB-API. It works with many databases including mySQL.

I had a hard time getting this working. I tried a lot of things, but here's what worked.

First I installed the mysql-devel package:

 sudo yum install mysql-devel

The I did:


sudo pip install MySQL-python

Now I can do an import MySQLdb, and it works!

No comments:

Post a Comment