Connect Django to MySQL ERROR "Did you install mysqlclient?"

Viewed 6317

I want Connect my Django Project To MySQL. I install mysqlclient already but when I migrate the project "python3 manage.py migrate" It has a bug!!!

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?

I don't know how to fix it! please help me

I Try to $ pip3 install mysql-python It ERROR!! like this :

Collecting mysql-python
  Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/cb/1r_2zrwn7597fzs9ktv0jbhh0000gn/T/pip-install-n72xlj1k/mysql-python/setup.py", line 13, in <module>
        from setup_posix import get_config
      File "/private/var/folders/cb/1r_2zrwn7597fzs9ktv0jbhh0000gn/T/pip-install-n72xlj1k/mysql-python/setup_posix.py", line 2, in <module>


           from ConfigParser import SafeConfigParser
        ModuleNotFoundError: No module named 'ConfigParser'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/cb/1r_2zrwn7597fzs9ktv0jbhh0000gn/T/pip-install-n72xlj1k/mysql-python/
1 Answers

Error itself tell what is the issue.

Did you try

pip install mysql-python

If this is not working make sure you have python-dev install . If you are on ubuntu use below.

apt-get install python3-mysqldb libmysqlclient-dev python-dev

For mac try this.

$ brew uninstall mysql
$ brew install mysql-connector-c
$ brew unlink mysql-connector-c
$ brew install mysql
$ pip install mysql-python
Related