pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost'

错误代码:

db = pymysql.connect(host='localhost',user='root', password='kk', port=3306)

将localhost改为:

db = pymysql.connect(host='127.0.0.1',user='root', password='kk', port=3306)

你可能感兴趣的:(出错,mysql)