The problem Im facing while trying to connect to database for mysql. I have also given the database settings that i have used.
Traceback (most recent call l
You are missing the python mysqldb
library. Use this command (for Debian/Ubuntu) to install it:
sudo apt-get install python-mysqldb
On Ubuntu it is advised to use the distributions repository.
sudo apt-get install python-mysqldb
I was having the same problem.The following solved my issue
Run pip install pymysql in your shell
Then, edit the init.py file in your project origin directory(the same as settings.py) and then
add:
import pymysql
pymysql.install_as_MySQLdb()
this should solve the problem.
This happened with me as well and I believe this has become a common error not only for Django developers but also for Flask as well, so the way I solved this issue was using brew.
brew install mysql
sudo pip install mysql-python
This way every single issue was solved and both frameworks work absolutely fine.
P.S.: For those who use macports (such as myself), this can be an issue as brew works in a different level, my advice is to use brew instead of macports
I hope I could be helpful.
Faced similar issue. I tried installing mysql-python
using pip, but it failed due to gcc dependency errors.
The solution that worked for me
conda install mysql-python
Please note that I already had anaconda installed, which didn't had gcc dependency.
It looks like you don't have the python mysql package installed, try:
pip install mysql-python
or if not using a virtual environment (on *nix hosts):
sudo pip install mysql-python