Menu Close

How to fix ImportError: No module named MySQL db with Python

Codeamend

Sometimes, we want to fix ImportError: No module named MySQLdb with Python.

In this article, we’ll look at how to fix ImportError: No module named MySQL db with Python.

How to fix ImportError: No module named MySQLdb with Python?

To fix ImportError: No module named MySQLdb with Python, we install the pymysql package.

To install it, we run

pip install pymysql 

Then we add a connection string with

SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://.....' 

Conclusion

To fix ImportError: No module named MySQLdb with Python, we install the pymysql package.

Posted in Python

You can also read...