situation
SQLALCHEMY_ DATABASE_ URI = ‘ mysql://username:password@server/db ‘
1
after operation, MySQL reports an error importerror: no module named ‘MySQL db’.
why
since there is no MySQL DB module, follow the normal idea
pip install MySQLdb
1
it should be able to solve this problem, but no corresponding module can be found. After checking, this is because mysql-3.23 through 5.5 and python-2.4 through 2.7 are currently supported.
solutions
looking for alternatives
in Python 3, we generally use pymysql.
implementation
pip install PyMySQL
1
change the database connection to
mysql+ pymysql://username:password@server/db
1
the next operation is normal