Unable to get flask_mysqldb to work with python 3.x

35 Views Asked by At

I have a flask application that uses flask_mysqldb to connect with database. I had imported MySQLdb and flask_mysqldb packages to use. Some update today morning screwed this. I had to replace MySQLdb with pymysql because it is not compatible with Python 3.x as per some threads here. The code is still not working because flask_mysqldb uses MySQLdb internally. I get the following error:

 from flask_mysqldb import MySQL
  File "/opt/homebrew/lib/python3.11/site-packages/flask_mysqldb/__init__.py", line 1, in <module>
    import MySQLdb
ModuleNotFoundError: No module named 'MySQLdb'

Any help on how I can resolve this is most welcome. I have been googling and going through different threads here and not getting anywhere.

0

There are 0 best solutions below