Q . Field 'class' doesn't have a default value error in MySQL 5.6 version

Brad Johnson. asked, Feb 17 ' 2015


I have upgraded my mysql 5.2 to 5.6 version.but at the time of insert I am getting the error of field doesnot have a default value.

Please help.

  • MySQL
  • default-value

1 Answers

You need to run this query on your MySQL database


mysql> show global variables like 'sql_mode';

        Variable_name                 Value
                sql_mode                      NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES


you go to the MySQL configuration file (my.cnf) and set the variable sql_mode to blank as given below.

sql_mode = ''

and restart your MySQL with below command in putty.

/etc/init.d/mysqld stop
/etc/init.d/mysqld start



Leave a Ansewer