Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Settings in django
How to install mysql-client to connect django and MySQL:
(1). Make sure the MySQL is installed
(2). Use the following command to install the package:
Ubuntu:
$sudo apt-get install libmysqlclient-dev
CentOS:
$ sudo apt-get install mysql-devel
(3). inside the virtualenv
$ pip3 install mysqlclient
(4). The database connection parameters setting
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'DB_NAME',
'USER': 'DB_USER',
'PASSWORD': 'DB_PASSWORD',
'HOST': 'localhost', # Or an IP Address that your DB is hosted on
'PORT': '3306',
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment