The question is so simple:
How can I used MySQL database with Django 1.9 + Python 3.4 in Fedora? I'm actually using a virtualenv if that adds more info.
I tried installing mysqlclient but that didn't work. And I really don't know how to go about the MySQL connector Python described here: MySQL DB API Drivers
When I try to install mysqlclient with pip it fails with: OSError: mysql_config not found.
解决方案
For python2
Try this steps:
yum install mysql mysql-server
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
# Create your username and password in MySQL
# Create your db in MySQL
yum install MySQL-python
For python2 or python3:
pip install mysqlclient
sudo apt-get install python3-dev libmysqlclient-dev
In settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': YOUR DB NAME,
'USER': YOUR USERNAME,
'PASSWORD': YOUR PASSWORD,
'HOST': 'localhost',
'PORT': 80,
}
}