【发布时间】:2019-09-19 05:18:41
【问题描述】:
我无法使用python 连接到MySQL 服务器,它给出了错误提示
MySQLdb._exceptions.OperationalError: (1130, "Host 'LAPTOP-0HDEGFV9' is not allowed to connect to this MySQL server")
我正在使用的代码:
import MySQLdb
db = MySQLdb.connect(host="LAPTOP-0HDEGFV9", # your host, usually localhost
user="root", # your username
passwd="abcd13de",
db="testing") # name of the data base
cur = db.cursor()
cur.execute("SELECT * Employee")
for row in cur.fetchall():
print(row[0])
db.close()
【问题讨论】:
标签: python mysql mysql-workbench mysql-python