Skip to content

Force MySQL/MariaDB connections to UTC timezone

Tony Butler requested to merge tony/kado:databaseForceUTC into master

Connection setup for MySQL and MariaDB engines now forces the timezone to UTC.

  • sets unilateral connection option timezone: 'Etc/GMT0'
  • sends one time on-connect query SET time_zone='+00:00';

This follows universal best practice because otherwise time/date are a mess. Users that may have not had DATE/DATETIME/TIMESTAMP fields stored as UTC already, will need to convert their data by shifting all affected fields value by the proper offset to make the equivalent date in UTC.

Mustache will display resulting Date objects in the server global (shell, not database) timezone when passed directly through from queries when everything is set up this way.

See also: this blog

Merge request reports