Error: SQLSTATE[HY000]: General error: 1366 Incorrect integer value

Problem:

I installed mysql DB 5.7.19 on my ubuntu server by default. After that, my all PHP projects that used queries with “Insert into integer with value ”” got errors like this:

Error: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ” for column

Solution 1

Temporary solution is to execute query:

SET @@GLOBAL.sql_mode= 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';

or with CLI MODE

mysql -u root -p -e "SET @@GLOBAL.sql_mode= 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';"

Solution 2

Configure your mysql server. Add this:

[mysqld]
 sql_mode = NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

to one of those files:

/etc/mysql/my.cnf

orĀ /etc/mysql/conf.d/mysql.cnf

2 thoughts on “Error: SQLSTATE[HY000]: General error: 1366 Incorrect integer value”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.