Problem:
MySQL throw the following error message on insert or update statement executed
1 |
ERROR 1366 (HY000): Incorrect integer value: '' for column 'id' at row 1 |
Why?
Try to update string value into integer column, and strict sql mode is enabled.
Mainly occurred on MySQL 5.x or above.
How to Fix:
1. Disable strict sql mode
Update /etc/my.cnf , and remove STRICT_TRANS_TABLES from sql-mode
1 2 3 |
#sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" to sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" |
References:
https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_strict_trans_tables