Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
341 views
in Technique[技术] by (71.8m points)

pymysql建立连接出错

conn=pymysql.connect(host='127.0.0.1',port=3306,unix_socket='/tmp/mysql.sock',
                user='root',passwd=None,db='mysql',charset='utf8')

cur=conn.cursor()
cur.execute("USE scraping")

报错:
pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: NO)")
请问是哪里出了问题
我用的是windows系统


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

windows系统不需要指定unix sock这个参数


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...