python数据库查询报错

在使用pymysql库执行数据库查询时报错

pymysql.err.OperationalError: (1017, "Can't find file: 'common_1' (errno: 2 - No such file or directory)")

错误的位置为

mycursor.execute(sql)

相关代码

mydb = pymysql.connect(host="localhost", user="root", password="root", db="mydatabase")
mycursor = mydb.cursor()
sql = "select * from " + table_name
mycursor.execute(sql)
result = mycursor.fetchall()

表名为 common_1

查看下你当前的用户,有没有这个表的读写权限,大概率是权限问题

创建数据库出现报错

(1017, "Can't find file: 'common_1' (errno: 2 - No such file or directory)")

common_1 是表名