解决SQLSyntaxErrorException: Incorrect table definition; there can be only one auto column and it must


问题描述

mysql数据库使用sql建表语句新建一张表,并还有自增的列

Caused by: java.sql.SQLSyntaxErrorException: Incorrect table definition; there can be only one auto column and it must be defined as a key

问题分析

java.sql。SQLSyntaxErrorException:表定义不正确;只能有一个自动列,必须将其定义为键

有自动增长的列,但是该列没有设置主键;

解决方案

  在创建表的SQL中,添加PRIMARY KEY (`LOG_NR_`)

 

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/java/289498.html

(0)
上一篇 2022年9月14日 22:47
下一篇 2022年9月15日 00:47

相关推荐

发表回复

登录后才能评论