==[ONLY for Ubuntu]== Install libmysqlclient-dev
$ sudo apt-get install libmysqlclient-dev
Install mysqlclient
.
$ sudo pip install mysqlclient
In settings.py
, find the following block:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
Replace it with:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': '[database name]',
'USER': '[database user with remote access privilege]',
'PASSWORD': '[password]',
'HOST': '[server ip address]',
'PORT': '',
}
}
On local OS X machine, open ~/.bash_profile
, and add the following line into it:
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
Run django system check.
$ python manage.py check
super().init(*args, **kwargs2)
django.db.utils.OperationalError: (1045, "Access denied for user 'root'@'180.151.27.218' (using password: YES)")