1
votes

I have some problem. I try to connect my Django project with mysqldb. I use python3.5 + Django + OSX. When i install python package mysqlclient (pip3 install mysqclient) and starting my project i get error:

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb 
module: dlopen(/lib/python3.5/site-packages/_mysql.cpython-35m-
darwin.so, 2): Symbol not found: _mysql_affected_rows

What does it mean? How can i fix this error. I try to reinstall mysqlclient, update mysql - nothing helps.

1
can you post your settings code? - Exprator
Please also include what version of OSX you're on, and how you installed MySQL (source? homebrew?). Thanks! - FlipperPA
@FlipperPA i use MySQL 5.7.18 Homebrew DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'mydb', 'USER': 'root', 'PASSWORD': 'root', 'HOST': '', 'PORT': '3306', } } - user2759544
Python 3.6, Django 1.11, OSX Sierra 10.12.3 - user2759544

1 Answers

0
votes

MySQLdb does not support Python 3. Fortunately, there are other engines you can use. Please see here:

https://docs.djangoproject.com/en/1.11/ref/databases/#mysql-db-api-drivers

I would recommend mysqlclient, which is a drop-in replacement for MySQLdb:

https://pypi.python.org/pypi/mysqlclient

Good luck!