From 0a4fd5d87babd223df424f7be6fa02ed4cdb495c Mon Sep 17 00:00:00 2001 From: Deven Bansod Date: Thu, 26 Nov 2015 15:13:29 +0530 Subject: [PATCH 1/2] Fixes issue 11691 Signed-off-by: Deven Bansod --- libraries/server_privileges.lib.php | 62 +++++++++++++++-------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index e5a1d0f74b..c3ea19cf0b 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -5126,39 +5126,15 @@ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password) $_REQUEST['authentication_plugin'] ); } - - // Use 'SET PASSWORD' for pre-5.7.6 MySQL versions - // and pre-5.2.0 MariaDB + // Use 'CREATE USER ... WITH ... AS ..' syntax for + // newer MySQL versions + // and 'CREATE USER ... USING .. VIA ..' syntax for + // newer MariaDB versions if (($serverType == 'MySQL' - && PMA_MYSQL_INT_VERSION < 50706) + && PMA_MYSQL_INT_VERSION >= 50706) || ($serverType == 'MariaDB' - && PMA_MYSQL_INT_VERSION < 50200) + && PMA_MYSQL_INT_VERSION >= 50200) ) { - - if ($_POST['pred_password'] == 'keep') { - $password_set_real = sprintf( - $password_set_stmt, - $slashedUsername, - $slashedHostname, - $slashedPassword - ); - } else if ($_POST['pred_password'] == 'none') { - $password_set_real = sprintf( - $password_set_stmt, - $slashedUsername, - $slashedHostname, - null - ); - } else { - $hashedPassword = PMA_getHashedPassword($_POST['pma_pw']); - $password_set_real = sprintf( - $password_set_stmt, - $slashedUsername, - $slashedHostname, - $hashedPassword - ); - } - } else { $password_set_real = null; // Required for binding '%' with '%s' @@ -5204,6 +5180,32 @@ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password) '***' ); } + } else { + // Use 'SET PASSWORD' syntax for pre-5.7.6 MySQL versions + // and pre-5.2.0 MariaDB versions + if ($_POST['pred_password'] == 'keep') { + $password_set_real = sprintf( + $password_set_stmt, + $slashedUsername, + $slashedHostname, + $slashedPassword + ); + } else if ($_POST['pred_password'] == 'none') { + $password_set_real = sprintf( + $password_set_stmt, + $slashedUsername, + $slashedHostname, + null + ); + } else { + $hashedPassword = PMA_getHashedPassword($_POST['pma_pw']); + $password_set_real = sprintf( + $password_set_stmt, + $slashedUsername, + $slashedHostname, + $hashedPassword + ); + } } // add REQUIRE clause From 83672ac65cd91951cc743a0db5e17e8a7f9e03b9 Mon Sep 17 00:00:00 2001 From: Deven Bansod Date: Thu, 26 Nov 2015 19:43:21 +0530 Subject: [PATCH 2/2] Changelog entry for #11691 Signed-off-by: Deven Bansod --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index e243b48b9b..0d3c0b2362 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ phpMyAdmin - ChangeLog - issue #11687 Delimiter missing while exporting multiple db routines - issue #11684 mysql_native_password with MariaDB bug - issue #11693 Flush privileges overusage - related to #11597 +- issue #11691 Query was empty on creating User in 4.5.2 4.5.2.0 (2015-11-23) - issue #11589 Incorrect parameter in mysqli_fetch_fields()