search

Home  >  Q&A  >  body text

python - 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系统

迷茫迷茫2784 days ago741

reply all(1)I'll reply

  • 迷茫

    迷茫2017-04-18 10:25:54

    Windows system does not need to specify the unix sock parameter

    reply
    0
  • Cancelreply