Error updating database. Cause: java.sql.SQLException: Field ‘id‘ doesn‘t have a default value

org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: java.sql.SQLException: Field 'id' doesn't have a default value
### The error may involve com.fanlan.Dao.blogDao.add1-Inline
### The error occurred while setting parameters
### SQL: insert into blog (title,author,create_time,views)         values (?,?,?,?)
### Cause: java.sql.SQLException: Field 'id' doesn't have a default value

更新数据库时出错。原因:java.sql.SQLException异常:字段“id”没有默认值

解决方案:

ALTER TABLE 表名  MODIFY 字段名 INT  AUTO_INCREMENT;

猜你喜欢

转载自blog.csdn.net/weixin_45627031/article/details/112374915
今日推荐