Set Up Local Environment for MySQL (Python + Django + XAMPP)

Set up local database – XAMPP
XAMPP has the full package for Apache + MySQL. “phpMyAdmin” is used for database management, which will be useful when import local database to web db (ex.

Install python package to interact with MySQL database
Option 1: import MySQLdb
pip install mysql-python (python 2.7) / pip install mysqlclient (python3.x)
Option 2: import mysql.connector
pip install mysql-connector-python

Configure Django to access a local MySQL database
Edit project file:

'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'database_name',
'USER': 'root',
'PASSWORD': 'root_password',
'HOST': 'localhost',


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s