Skip to content

Instantly share code, notes, and snippets.

@anthonyray
Last active September 21, 2017 07:46
Show Gist options
  • Save anthonyray/dd9895504040a0e54278 to your computer and use it in GitHub Desktop.
Save anthonyray/dd9895504040a0e54278 to your computer and use it in GitHub Desktop.
Connecting Python to a MySQL database

I had a hard time installing a python connector to a MySQL database. I tried to install MySQLdb but had problems during compilation. Fortunately, MySQL release a connector written in Python. I wanted to install it in a virtual environnement.

To do so :

venv environnement
cd environnement 
source bin/activate

pip install mysql-connector-repackaged

To check the installation is working

import mysql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment