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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *