From 19990c92197c64588ac489fda6c23e34702d7db0 Mon Sep 17 00:00:00 2001
From: Venkata Sidagam <venkata.sidagam@oracle.com>
Date: Thu, 31 Oct 2013 23:02:44 +0530
Subject: Bug #12917164 DROP USER CAN'T DROP USERS WITH LEGACY     UPPER CASE
 HOST NAME ANYMORE

Description:
It is not possible to drop users with host names with upper case
letters in them. i.e DROP USER 'root'@'Tmp_Host_Name'; is failing
with error.

Analysis: Since the fix 11748570 we came up with lower case hostnames
as standard. But in the current bug the hostname is created by
mysql_install_db script is still having upper case hostnames.
So, if we have the hostname with upper case letters like(Tmp_Host_Name)
then we will have as it is stored in the mysql.user table.
In this case if use "'DROP USER 'root'@'Tmp_Host_Name';" it gives
error because we do compare with the lower case of hostname since the
11748570 fix.

Fix: We need to convert the hostname to lower case before storing into
the mysql.user table when we run the mysql_install_db script.
---
 scripts/mysql_system_tables_fix.sql | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'scripts/mysql_system_tables_fix.sql')

diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index 09f66c79c3f..56f6a64211a 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -601,6 +601,9 @@ ALTER TABLE db MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT
 
 UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0;
 
+# Convering the host name to lower case for existing users
+UPDATE user SET host=LOWER( host ) WHERE LOWER( host ) <> host;
+
 # Activate the new, possible modified privilege tables
 # This should not be needed, but gives us some extra testing that the above
 # changes was correct
-- 
cgit v1.2.1

