Did you install a new MySQL and things just aren't working the way you're used to?
WHAT?? ME TOO!!
In this case, I'm inserting just a few columns, and there are non-specified columns without default values.
In my other database it just works - I know, not correct behavior, but it's what I'm used to.
In my new database I get this error:
ERROR 1364 (HY000): Field 'xxx' doesn't have a default value
So what's the difference?
STRICT MODE
Thanks, documentation!!
Before, strict mode. Giving me an error...
mysql> select @@GLOBAL.sql_mode;
+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@GLOBAL.sql_mode |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
After, non-strict mode. Working like my other database!
mysql> SET GLOBAL sql_mode = '';
Query OK, 0 rows affected, 1 warning (0.00 sec)
No comments:
Post a Comment