mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 07:01:54 +00:00
Fix locally created database (#56889)
* zoneminder: fix initial database creation Move initialDatabases directive from the 'ensureUsers' scope to the correct outer 'mysql' one. * zoneminder: Fix mysql username to match unix username When database.createLocally is used, a mysql user is created with the ensureUsers directive. It ensures that the unix user with the name provided exists and can connect to MySQL through socket. Thus, the MySQL username used by php/perl scripts must match the unix user owning the server PID. This patch sets the default mysql user to 'zoneminder' instead of 'zmuser'.
This commit is contained in:
parent
32e9296244
commit
d7f6cdeda4
@ -49,7 +49,7 @@ let
|
||||
# Database
|
||||
ZM_DB_TYPE=mysql
|
||||
ZM_DB_HOST=${cfg.database.host}
|
||||
ZM_DB_NAME=${cfg.database.name}
|
||||
ZM_DB_NAME=${if cfg.database.createLocally then user else cfg.database.username}
|
||||
ZM_DB_USER=${cfg.database.username}
|
||||
ZM_DB_PASS=${cfg.database.password}
|
||||
|
||||
@ -205,12 +205,12 @@ in {
|
||||
|
||||
mysql = lib.mkIf cfg.database.createLocally {
|
||||
ensureDatabases = [ cfg.database.name ];
|
||||
initialDatabases = [{
|
||||
inherit (cfg.database) name; schema = "${pkg}/share/zoneminder/db/zm_create.sql";
|
||||
}];
|
||||
ensureUsers = [{
|
||||
name = cfg.database.username;
|
||||
ensurePermissions = { "${cfg.database.name}.*" = "ALL PRIVILEGES"; };
|
||||
initialDatabases = [
|
||||
{ inherit (cfg.database) name; schema = "${pkg}/share/zoneminder/db/zm_create.sql"; }
|
||||
];
|
||||
}];
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user