From 7e416522de13201660969ac1c391fbc0ff4aa435 Mon Sep 17 00:00:00 2001 From: Till Brehm Date: Tue, 24 Jan 2017 16:12:52 +0100 Subject: [PATCH] Fixed #4409 Password of MySQL users does not get updated on MySQL 5.7 servers --- server/plugins-available/mysql_clientdb_plugin.inc.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/plugins-available/mysql_clientdb_plugin.inc.php b/server/plugins-available/mysql_clientdb_plugin.inc.php index 0c6a98cf54..8b04844e22 100644 --- a/server/plugins-available/mysql_clientdb_plugin.inc.php +++ b/server/plugins-available/mysql_clientdb_plugin.inc.php @@ -143,9 +143,13 @@ class mysql_clientdb_plugin { if(!$link->query("RENAME USER '".$link->escape_string($database_user)."'@'$db_host' TO '".$link->escape_string($database_rename_user)."'@'$db_host'")) $success = false; } elseif($action == 'PASSWORD') { //if(!$link->query("SET PASSWORD FOR '".$link->escape_string($database_user)."'@'$db_host' = '".$link->escape_string($database_password)."'")) $success = false; - // SET PASSWORD for already hashed passwords is not supported by latest MySQL 5.7 anymore, so we set it directly + // SET PASSWORD for already hashed passwords is not supported by latest MySQL 5.7 anymore, so we have to set the hashed password directly if(trim($database_password) != '') { - if(!$link->query("UPDATE mysql.user SET `Password` = '".$link->escape_string($database_password)."' WHERE `Host` = '".$db_host."' AND `User` = '".$link->escape_string($database_user)."'")) $success = false; + // MySQL < 5.7 and MariadB 10 + if(!$link->query("UPDATE mysql.user SET `Password` = '".$link->escape_string($database_password)."' WHERE `Host` = '".$db_host."' AND `User` = '".$link->escape_string($database_user)."'")) { + // MySQL 5.7, the Password field has been renamed to authentication_string + if(!$link->query("UPDATE mysql.user SET `authentication_string` = '".$link->escape_string($database_password)."' WHERE `Host` = '".$db_host."' AND `User` = '".$link->escape_string($database_user)."'")) $success = false; + } if($success == true) $link->query("FLUSH PRIVILEGES"); } } -- GitLab