If you get mysql error:
«Field xxx doesn’t have a default value»
This means that when inserting or updating data, the field does not have a default value. To solve the problem you need:
- find this request and fix it, add the required field;
- in the table properties specify the default value;
Another solution is turning off mysql mode: “Strict Mode”, i.e. we turn off strict compliance with MySql.
You can turn it off in the my.ini config:
writing instead:
# Set the SQL mode to strict sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
following code:
# Set the SQL mode to strict sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Or by running the following query:
SET @@GLOBAL.sql_mode= '' SET @@SESSION.sql_mode= ''
When strict mode is turned off: for numeric values, the default will be 0, and for string - there will be an empty string.
Similar Posts:
- How to disable MySQL Strict Mode?
- How to replace MySQL with Percona Server on Debian or Ubuntu
- How to install phpMyAdmin with nginx on Debian 11
- MySQL Timezone Create Table SQL Script
- Howto Set Up Named Time Zones in MySQL
1,981