系統 - CentOS - 解決ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry問題



參考資料:
https://stackoverflow.com/questions/5402949/mysql-cant-make-column-auto-increment

如果Table裡面已經有資料,改成auto_increment屬性時,會有ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry錯誤,解法如下:

mysql> SET SESSION sql_mode='NO_AUTO_VALUE_ON_ZERO';

P.S. 執行後,再修改成auto_increment屬性就可以