I have tried to use a new, empty database, but that did not work. Still got the question if I have installed MySQLclient.
Tried the statements from Desh Deepak. The install and import went well. However, when I tried to migrate, I got the message: module 'pymysql' has no attribute 'install_as_MySqldb'. I put this statement directly below the import statement.
Below is some of my additional background info that may help.
i am begining a django project and want to use MySQL instead of SQLlite. So, I watched a video to learn how to use MySQL with Python. VBased on that, I was able to install MySQL into a C:\MySQL directory successfully. I also created a database with userid(root) and password. Then I wrote a Python program that read in a CSV file, created a table in the same database and then INSERTed the rows into the table. Also needed to 'import mysql.connector'. Using SQL Workbench, I was able to verify that all was successful.
Next I tried to access this database from Django without success. Here's what I did. First I created a virtual environment and then activated it. Next, ran 'django-admin startproject <kprojectr name> . This created the settings file, but it is set up for SQLlite. I edited this file to change these parameters:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'gammon',
'USER':'root',
'PASSWORD':'1ltarty#',
I skip the 'migrate' step. Next was 'python manage.py runserver. This failed. I got many error message which I saved in a text file. At the beginning of the messages MySQLdb could not be imported as it couldn't be found. Neat the end of the errors, there is a message asking if I had insjtalled mysqlclient.
I have researched these two errors without much success. I tried to install MySQLclient, but always get a message that the requirement was already satisfied. I cannot find any module MySQLdb anywhere on my PC. I think these two areas are related. Since I am able to use MySQL with vanilla Python successfully, I suspect I have a PATH error perhaps.
I am now at a loss as to what I might try next. Does anyone have any ideas? All comments appreciated.