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

An error occurred while updating the database. Reason: java.sql.SQLException: Field "id" has no default value

solution:

ALTER TABLE 表名  MODIFY 字段名 INT  AUTO_INCREMENT;

Guess you like

Origin blog.csdn.net/weixin_45627031/article/details/112374915