pymysql.err.Internal报107错误

下面一起来了解下pymysql.err.Internal报107错误,相信大家看完肯定会受益匪浅,文字在精不在多,希望pymysql.err.Internal报107错误这篇短内容是你想要的。

pymysql.err.InternalError: (1075, 'Incorrect table definition; there can be only one auto column and it must be defined as a key')

pymysql.err.Internal报107错误
python中使用pymysql创建table是报错是上面标题,sql语句如下:
sql = '''
create table music (
id int not null auto_increment,
song text,
singer text,
genre text,
issue text,
publisher text,
score text)'''
百度,问题是:自增字段必须是主键。解决办法是设置id为主键。
修改后sql为:
sql = '''
create table music (
id int not null auto_increment,
song text,
singer text,
genre text,
issue text,
publisher text,
score text,
primary key(id)
)'''

看完pymysql.err.Internal报107错误这篇文章后,很多读者朋友肯定会想要了解更多的相关内容,如需获取更多的行业信息,可以关注我们的行业资讯栏目。