ModuleNotFoundError: No module named ‘MySQLdb‘

ModuleNotFoundError: No module named ‘MySQLdb’
MySQLdb在python3不能直接安装,可以安装pymysql,然后import pymysql as MySQLdb
需要改下:

#旧
db = MySQLdb.connect("xx.xx.xx.xx", "xx", "xxxx", database_name, port=xxx, charset="xxx")
#新
db = MySQLdb.connect(
	host = "xx.xx.xx.xx", 
	user = "xxx", 
	password = "xxx", 
	database = database_name, 
	port = xxx, 
	charset = "xxx")

你可能感兴趣的:(python,python,数据库,开发语言,MySQLdb,pymysql)