Import error :No module named MYSQLdb
Solution 1:
You have to install the module with:
sudo apt-get install python-mysqldb
Reference: This thread on SO
Solution 2:
sudo apt install libmysqlclient-dev
then
-
for python 2.x:
pip install mysql-python
-
for python 3.x:
pip install mysqlclient
orpip3 install mysqlclient
Solution 3:
Unfortunately MySQLdb does not support Python 3.
You basically have two options:
Run your script using python2.7, that way you won't need to change the MySQL module. The downside is that you'll probably have to convert some code to python2.x.
Look for python3.x supported modules as explained here: Python 3.4.0 with MySQL database.