MYSQLDB设置字符集出错

conn = MySQLdb.connect(host='localhost',user='root',passwd='xoyo.com',db='aaa',port=3306,charset="utf-8")
self.DB = conn.cursor()

会报错 Can’t initialize character set UTF-8

 

试着删掉 – OK

conn = MySQLdb.connect(host='localhost',user='root',passwd='xoyo.com',db='aaa',port=3306,charset="utf8")
self.DB = conn.cursor()