Categories
Python Answers

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

Spread the love

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 MySQLdb 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.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.