MYSQL: how to fix error #1364 – Field ‘name’ doesn’t have a default value

Field name doesnt have a default value

Step 1: check sql_mode

select @@GLOBAL.sql_mode

mysql sql mode

You see STRICT_TRANS_TABLES in that value.

Step 2: use as root account then use this command:

set GLOBAL sql_mode = REPLACE( @@GLOBAL.sql_mode , 'STRICT_TRANS_TABLES,','')

Done, however, you should do more 2 steps (3 and 4) to fix this error on next reboot

Step 3: find your my.cnf

[root@tutorialspots ~]# cd /
[root@tutorialspots /]# find -name my.cnf

Step 4: add a line to my.cnf, in section [mysqld]


Or with mariadb file /etc/my.cnf.d/mariadb-server.cnf

If section [mysqld] at end of the file, you can use this command line:


Leave a Reply