Blog | Technical
Mysql Maria DB fields don’t have default value
When upgrading to MariaDB I found some queries were getting rejected due to field value not being NULL.
On mysql this was not a problem as I had intended if no data then I`m happy with the query.
I foudn you can remove configuration in `sql_mode` the STRICT_TRANS_MODE.
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,`STRICT_TRANS_TABLES`,``));
showing the values gives this:
SELECT @@SQL_MODE, @@GLOBAL.SQL_MODE;
@@SQL_MODE ::
ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
@@GLOBAL.SQL_MODE ::
ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
I am not sure this is saving after a MariaDb reboot, but with thanks to Virtualmin staff I updated this file:
/etc/mysql/mariadb.conf.d/50-server.cnf
with this:
[mariadb-10.3]
sql_mode = ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION
restarted MariaDB and it has saved the details after a restart.