From 60621da2437711fd83aca78698ba5540ef732617 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Mon, 1 Jan 2024 12:24:45 +0100 Subject: [PATCH] dont use deprecated 'mysql_native_password' for mysql8; fixes #1214 Signed-off-by: Michael Kaufmann --- lib/Froxlor/Install/Install/Core.php | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/lib/Froxlor/Install/Install/Core.php b/lib/Froxlor/Install/Install/Core.php index 839f856a..ca21780e 100644 --- a/lib/Froxlor/Install/Install/Core.php +++ b/lib/Froxlor/Install/Install/Core.php @@ -301,8 +301,8 @@ class Core /* continue */ } } - if (version_compare($db_root->getAttribute(PDO::ATTR_SERVER_VERSION), '10.0.0', '>=')) { - // mariadb compatibility + if (version_compare($db_root->getAttribute(PDO::ATTR_SERVER_VERSION), '8.0.11', '>=')) { + // mariadb & mysql8 // create user $stmt = $db_root->prepare("CREATE USER '" . $username . "'@'" . $access_host . "' IDENTIFIED BY :password"); $stmt->execute([ @@ -314,19 +314,6 @@ class Core "username" => $username, "host" => $access_host ]); - } elseif (version_compare($db_root->getAttribute(PDO::ATTR_SERVER_VERSION), '8.0.11', '>=')) { - // mysql8 compatibility - // create user - $stmt = $db_root->prepare("CREATE USER '" . $username . "'@'" . $access_host . "' IDENTIFIED WITH mysql_native_password BY :password"); - $stmt->execute([ - "password" => $password - ]); - // grant privileges - $stmt = $db_root->prepare("GRANT ALL ON `" . $database . "`.* TO :username@:host"); - $stmt->execute([ - "username" => $username, - "host" => $access_host - ]); } else { // grant privileges $stmt = $db_root->prepare("GRANT ALL PRIVILEGES ON `" . $database . "`.* TO :username@:host IDENTIFIED BY :password");