Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySql Error: 1364 Field 'display_name' doesn't have default value

Tags:

php

mysql

I have just switched from a MAMP installation to a native Apache, MySql and PHP installation. I have got everything working, but I have started using my web app in the new environment and suddenly any INSERT commands are resulting in the following error:

SQLSTATE[HY000]: General error: 1364 Field 'display_name' doesn't have a default value

It seems the I am unable to leave a field blank now where I was able to before. I am using MySql version 5.6.13

Is there a way to change this setting in MySql?

like image 500
Ben Thompson Avatar asked Sep 11 '13 21:09

Ben Thompson


People also ask

How do I fix error 1364 in mysql?

Error 1364 indicates that the value of the particular field should be something other than NULL. One way to resolve the error forever is to make the column as DEFAULT NULL in table definition but if that does not meet your requirement, let us see some ways to fix this error in the below sections.


1 Answers

MySQL is most likely in STRICT mode.

Try running SET GLOBAL sql_mode='' or edit your my.cnf to make sure you aren't setting STRICT_ALL_TABLES or the like.

like image 95
Tim B Avatar answered Oct 04 '22 09:10

Tim B