raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient? code example

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

//For Mysql
sudo apt-get install libmysqlclient-dev

//If you are using MariaDB
sudo apt-get install libmariadbclient-dev

pip install mysqlclient

/*
	If you are getting a error like
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    then : 
*/
sudo apt-get install python3-dev

//Then 
pip install mysqlclient

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

pip install pymysql

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

import pymysql

pymysql.install_as_MySQLdb()

Tags:

Sql Example