Skip to content

Commit 7dc05a4

Browse files
author
Venkata Sidagam
committed
Bug #12917164 DROP USER CAN'T DROP USERS WITH LEGACY
UPPER CASE HOST NAME ANYMORE Merging from mysql-5.5 to mysql-5.6
2 parents 9e0057d + 35581bd commit 7dc05a4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

scripts/mysql_system_tables_data.sql

+3-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
-- Get the hostname, if the hostname has any wildcard character like "_" or "%"
2525
-- add escape character in front of wildcard character to convert "_" or "%" to
2626
-- a plain character
27-
SET @get_hostname= @@hostname;
28-
SELECT REPLACE((SELECT REPLACE(@get_hostname,'_','\_')),'%','\%') INTO @current_hostname;
27+
SELECT LOWER( REPLACE((SELECT REPLACE(@@hostname,'_','\_')),'%','\%') )INTO @current_hostname;
2928

3029

3130
-- Fill "db" table with default grants for anyone to
@@ -41,11 +40,11 @@ DROP TABLE tmp_db;
4140
-- from local machine if "user" table didn't exist before
4241
CREATE TEMPORARY TABLE tmp_user LIKE user;
4342
INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N');
44-
REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N' FROM dual WHERE LOWER( @current_hostname) != 'localhost';
43+
REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N' FROM dual WHERE @current_hostname != 'localhost';
4544
REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N');
4645
REPLACE INTO tmp_user VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N');
4746
INSERT INTO tmp_user (host,user) VALUES ('localhost','');
48-
INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOWER(@current_hostname ) != 'localhost';
47+
INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE @current_hostname != 'localhost';
4948
INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0;
5049
DROP TABLE tmp_user;
5150

scripts/mysql_system_tables_fix.sql

+2
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,8 @@ INSERT INTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now(
628628
INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0;
629629
DROP TABLE tmp_proxies_priv;
630630

631+
# Convering the host name to lower case for existing users
632+
UPDATE user SET host=LOWER( host ) WHERE LOWER( host ) <> host;
631633

632634
#
633635
# mysql.ndb_binlog_index

0 commit comments

Comments
 (0)