Search code examples
mysqlerror-handlingbackwards-compatibility

Query failed with the following: (Error #1366) Incorrect integer value: '' for column; how to set version compatibility


Here is my current version of MySQL:

mysql  Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using  EditLine wrapper

Here is the previous version:

mysql  Ver 14.14 Distrib 5.5.47, for Linux (x86_64) using readline 5.1

The query (abbereviated) that I'm trying to run is:

INSERT INTO bais_logs SET editor_id = '', type = 'basic'; -- no editor

And I get the error specified. editor_id is a INT(10) UNSIGNED NOT NULL

It worked in the previous version, and it will be difficult and time-consuming to update the related queries. Is there any way to set compatibility with the MySQL 5.5 server so that this would just ignore the '' and proceed?


Solution

  • I am not sure but I think that the SQL mode has changed on your database. Try to change it accordingly after reading https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-important