当我访问数据库虽然我已经在mysql数据库中更新了用户但仍然无法运行脚本来访问mysql。
import pymysql.cursors
connection=pymysql.connect(host='localhost',user='szp',password='letmein',db='cactidb',charset='utf8mb4',cursorclass=pymysql.cursors.DictCursor)
print("connection succeeds!")
try:
with connection.cursor() as cursor:
sql="SELECT ...;"
cursor.execute(sql)
print("cursor.description:",cursor.description)
print()
for row in cursor:
print(row)
finally:
connection.close()
运行脚本时出现此错误!
pymysql.err.InternalError: (1698, u"Access denied for user 'szp'@'localhost'")
任何人都可以帮忙解决这个问题吗?