Error loading MySQLdb module: No module named ‘MySQLdb’

MySQLdb is only for Python 2.x. You can’t install in Python 3.x versions. Now from your question i can see that you are working with Django. In this case you have three alternatives, from Django mysql notes:

  • mysqldb
  • mysqlclient
  • mysql-connect-python

This gives to you two alternatives, mysqlclient and mysql-connect-python, The first one requires compilation from extensions for the plugin and, in Windows, this implies VStudio Libraries and a know-how for compile native extensions.

mysql-connect-python is not compiled (and i don’t recommend this for production, maybe only for dev) so you are going to need to install this.

You can try:

pip3 install mysql-connect-python

or

pip3 install http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip

if the first one fails.

Leave a Comment