python3.5+;MySQLdb:';字符集';是无效的关键字参数

python3.5+;MySQLdb:';字符集';是无效的关键字参数,python,mysql,utf-8,character-encoding,Python,Mysql,Utf 8,Character Encoding,我正在使用python3.6。 正如上面的链接所说,我就是这样做的: import _mysql try: db = _mysql.connect(host='localhost', user='root', passwd='password', db='mydb', charset='utf8') except Exception as e: print(str(e)) 但是,我得到一个错误: “charset”是此函数的无效

我正在使用python3.6。

正如上面的链接所说,我就是这样做的:

import _mysql

try:
            db = _mysql.connect(host='localhost', user='root', passwd='password', db='mydb', charset='utf8')
        except Exception as e:
            print(str(e))
但是,我得到一个错误:

“charset”是此函数的无效关键字参数


如果我删除
charset='utf8'
,一切都会好起来。但是我需要
utf8
,因为我的数据库中有一些特殊字符。

什么是
\u mysql
?也许你的意思是
MySQLdb
?也许还需要
使用\u unicode=True

更多Python注释: