On 09/01/17 17:28, Davide Franco wrote:
> Do you use MySQL or MariaDb ?
> 
> It is something related to default value for datetime fields.
> 
> MariaDb does not accept 0 or Null ( I don't remember). You need the
> check previous thread in this mailing list.


This is correct, it is not a MariaDB vs. MySQL issue, it is a
MariaDB/MySQL *version* issue.  MySQL 5.6 and older allowed DATETIME and
TIMESTAMP fields to have the value 0, which is technically not valid for
those datatypes.  MySQL 5.7 and MariaDB 10.2, as configured out of the
box, enforce validity of DATETIME and TIMESTAMP types, and do not allow
them to be 0 or to contain zero year, month or day fields (since there
is no year 0, month 0, or day 0).[1]


There is a simple configuration fix for this that does not require any
changes to Bacula or your Catalog:

1.  Log into your database.
2.  SELECT @@GLOBAL.SQL_MODE;
3.  SET GLOBAL SQL_MODE='new value';

...Where you get the new SQL_MODE by REMOVING the modes NO_ZERO_DATE and
NO_ZERO_IN_DATE from whatever SQL_MODE you got in step 2.  Or, you can
skip 2 and just set SQL_MODE to something reasonable like
'STRICT_ALL_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'.

Make sure that you set this both in the running database instance and in
your configuration files, and of course do the same on any replication
slaves.  Make sure you check ALL POSSIBLE config files for the SQL_MODE
setting.  Sometimes you will find it in unexpected places like <data
directory>/auto.cnf.  For safety, restart your database and make certain
that after restart, SQL_MODE is set to what you want it to be.

Once you have done this, you should have no further problems with the
Bacula catalog and zero values.



[1]  Zeros in the time part are fine, because hours are 0-23, minutes
are 0-59, and seconds are 0-60 (because leap seconds).


-- 
  Phil Stracchino
  Babylon Communications
  ph...@caerllewys.net
  p...@co.ordinate.org
  Landline: +1.603.293.8485
  Mobile:   +1.603.998.6958

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to