From 759df9ef42b3f36e045b228cebafcbec0644f1c9 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Tue, 28 Apr 2026 19:10:16 +0900 Subject: [PATCH] server/sql: flush privileges after modification --- docs/installation.md | 2 +- src/server/sql/database_privilege_operations.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/installation.md b/docs/installation.md index 758a98d..be742d6 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -42,7 +42,7 @@ on the MySQL server as the admin user (or another user with sufficient privilege ```sql CREATE USER `muscl`@`localhost` IDENTIFIED BY ''; GRANT SELECT, INSERT, UPDATE, DELETE ON `mysql`.* TO `muscl`@`localhost`; -GRANT GRANT OPTION, CREATE, DROP ON *.* TO `muscl`@`localhost`; +GRANT GRANT OPTION, CREATE, DROP, RELOAD ON *.* TO `muscl`@`localhost`; FLUSH PRIVILEGES; ``` diff --git a/src/server/sql/database_privilege_operations.rs b/src/server/sql/database_privilege_operations.rs index 7fb41f5..de2bbf3 100644 --- a/src/server/sql/database_privilege_operations.rs +++ b/src/server/sql/database_privilege_operations.rs @@ -487,6 +487,10 @@ pub async fn apply_privilege_diffs( results.insert(key, result); } + if let Err(err) = connection.execute("FLUSH PRIVILEGES").await { + tracing::error!("Failed to flush privileges: {}", err); + } + results .into_iter() .map(|((k1, k2), v)| (k1, (k2, v)))