python连接mysql数据库时如果报错上述错误,在确定自己的参数是没有问题的时候
conn= MySQLdb.connect(
host='localhost',
port = 3306,
user='root',
passwd='930325',
db ='test',
)
可以将参数修改后再尝试连接:
conn= MySQLdb.connect(
host='127.0.0.1',
port = 3306,
user='root',
passwd='930325',
db ='test',
)