Using pymysql with pycharm

2019-08-24 18:33发布

问题:

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 runs fine

回答1:

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")

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.

Your error message also states that password is not given by using password: NO