• ADADADADAD

    pymysql.err.InternalError: 107[ mysql数据库 ]

    mysql数据库 时间:2024-12-03 12:13:30

    作者:文/会员上传

    简介:

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

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

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


    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)
    )'''
    感谢:https://www.cnblogs.com/guodongdidi/p/6290782.html

    pymysql.err.InternalError: 107.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: pythonpymysql自增id