summary refs log tree commit diff
path: root/nixos/modules/services/databases/mysql.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/databases/mysql.nix')
-rw-r--r--nixos/modules/services/databases/mysql.nix3
1 files changed, 2 insertions, 1 deletions
diff --git a/nixos/modules/services/databases/mysql.nix b/nixos/modules/services/databases/mysql.nix
index 60c6b22e0595..0b2f99f8fff1 100644
--- a/nixos/modules/services/databases/mysql.nix
+++ b/nixos/modules/services/databases/mysql.nix
@@ -240,8 +240,9 @@ in
                     # Set up the replication master
 
                     ( echo "use mysql;"
+                      echo "CREATE USER '${cfg.replication.masterUser}'@'${cfg.replication.slaveHost}' IDENTIFIED WITH mysql_native_password;"
+                      echo "SET PASSWORD FOR '${cfg.replication.masterUser}'@'${cfg.replication.slaveHost}' = PASSWORD('${cfg.replication.masterPassword}');"
                       echo "GRANT REPLICATION SLAVE ON *.* TO '${cfg.replication.masterUser}'@'${cfg.replication.slaveHost}';"
-                      echo "update user set Password=password('${cfg.replication.masterPassword}') where User='${cfg.replication.masterUser}';"
                     ) | ${mysql}/bin/mysql -u root -N
                   ''}