MySQL Default Values must be Overriden

We have observed a serious issue that can occur when using the default MySQL configuration (Linux and Windows). Before creating the schema you must override the MySQL defaults.

In MySQL Workbench run the query below to check if the problem exists in your system:

show variables like 'sql_mode'; 

Then check the output. If the sql-mode variable contains either or both of the two entries NO_ZERO_IN_DATE,NO_ZERO_DATE then perform the steps below. (If neither of these two entries is present in the variable then carry on with creating the schema.)

Example of problem code:

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

On Linux: To fix the problem open the my.cnf file in /etc/mysql for editing and cut the two entries:

NO_ZERO_IN_DATE,NO_ZERO_DATE

Also ensure that the command [mysqld] which runs the MySQL server daemon is present. The picture below is an example of what the line might look like after editing.

On Windows: To fix the problem open the my-default.ini file in C:\Program Files\MySQL\MySQL Server (version#) then cut the entries NO_ZERO_IN_DATE,NO_ZERO_DATE and save the file.

How can we help?

Chat with us and we will take you through our site!

Read about how we use cookies and how you can control them by clicking "Cookie Settings." If you continue to use this site, you consent to our use of cookies.