Monthly Archive: October 2019

Insert empty ” to integer type column cause error in MySQL

Problem: MySQL Error “Incorrect integer value for column.. ” when I want to insert empty string to integer type column.

It is because SQL_MODE being in STRICT mode. Normally it should work before MySQL 5.7

Solution: edit my.cnf file and remove strict mode value

First use

mysql --help | grep /my.cnf | xargs ls

to find my.cnf location

Then edit /etc/my.cnf, change sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES to

sql_mode=""

Then restart MySQL, for CentOS:

service mysqld restart

Close Bitnami banner
Bitnami