问题描述
我正在尝试使用与mysql同步的db运行项目。由于这个错误,我已经有一个星期无法开始了。请帮助我
I am trying to run a project with db synchronized with pymysql. I have not been able to start for a week due to this error. Please help me
mysql运行正常
mysql runs fine
推荐答案
您的连接代码写为 pymysql.connect(host = locahost, user = root,password = xxxx)
,但是 pymysql.connect
要求您提供密码,且其命名参数为 passwd。因此,如果将其更改为以下内容,它应该可以正常工作。
Your connection code is written as pymysql.connect(host="locahost", user="root", password="xxxx")
but pymysql.connect
requires you to provide password with the named argument as "passwd". So if you change it to the following, it should work fine.
conn = pymysql.connect(host="localhost", user="root", passwd="xxx")
在pymysql的github中似乎存在差异自述文件。在示例代码中,它说 password =,但是在其他源文件中,它说 passwd =,而且我一直在使用 passwd,并且工作正常。
There seem to have discrepencies in the pymysql's github readme. In the example code, it says "password=", but in other source files, it says "passwd=" and I always been using "passwd" and it works fine.
您的错误消息还指出,没有使用密码提供密码:NO
Your error message also states that password is not given by using password: NO
这篇关于将pymysql与pycharm一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!