Search code examples
mysqlauto-increment

mysql auto increment field error 1336 Incorrect integer value


Recently upgraded to mysql 5.6.30, throwing out mysql auto incrment error

1366 - Incorrect integer value: '' for column 's


Solution

  • Probably your new Mysql installation runs on strict mode while your previous one did not.And you probably have an empty value in some column which is defined as integer so you get this error.

    Go at your my.cnf/my.ini file and look for this line

     sql-mode = "STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
    

    Change it to blank:

      sql-mode="" 
    

    This would disable the strict mode and the error would be converted to warning

    BUT

    the best aprroach would to be to change the empty field value to a valid integer value.