SET SQL_MODE=”NO_AUTO_VALUE_ON_ZERO”

A super detailed tutorial: springboot integrates mybatis plus>>>

NO_ AUTO_ VALUE_ ON_ Zero affects Auto_ Processing of the increment column. In general, you can insert null or 0 into the column to generate the next sequence number. NO_ AUTO_ VALUE_ ON_ Zero disable 0, so only null can generate the next sequence number.

If you save 0 to the table’s auto_ The increment column, which is useful( This practice is not recommended). For example, if you dump a table with mysqldump and overload it, MySQL will generate a new serial number when it encounters a value of 0. The content of the generated table is different from that of the dumped table. Enable no before reloading dump files_ AUTO_ VALUE_ ON_ Zero can solve this problem.

Similar Posts: