diff --git a/nixos/doc/manual/release-notes/rl-1909.xml b/nixos/doc/manual/release-notes/rl-1909.xml index 60b4a3bc17b..ef2b1d34189 100644 --- a/nixos/doc/manual/release-notes/rl-1909.xml +++ b/nixos/doc/manual/release-notes/rl-1909.xml @@ -161,6 +161,17 @@ The hunspellDicts.fr-any dictionary now ships with fr_FR.{aff,dic} which is linked to fr-toutesvariantes.{aff,dic}. + + + + The mysql service now runs as mysql + user. Previously, systemd did execute it as root, and mysql dropped privileges + itself. + This includes ExecStartPre= and + ExecStartPost= phases. + To accomplish that, runtime and data directory setup was delegated to + RuntimeDirectory and tmpfiles. + diff --git a/nixos/modules/services/databases/mysql.nix b/nixos/modules/services/databases/mysql.nix index 7b097e95e14..97e58fd228f 100644 --- a/nixos/modules/services/databases/mysql.nix +++ b/nixos/modules/services/databases/mysql.nix @@ -326,6 +326,8 @@ in ''; serviceConfig = { + User = cfg.user; + Group = "mysql"; Type = if hasNotify then "notify" else "simple"; # /run/mysqld needs to be created in addition to pidDir, as they could point to different locations RuntimeDirectory = "mysqld";