diff options
author | Venkata Sidagam <venkata.sidagam@oracle.com> | 2013-10-31 23:02:44 +0530 |
---|---|---|
committer | Venkata Sidagam <venkata.sidagam@oracle.com> | 2013-10-31 23:02:44 +0530 |
commit | 19990c92197c64588ac489fda6c23e34702d7db0 (patch) | |
tree | 3d4a31ba5c5d14bf1ad075f45a5ff9acbfca93f3 /scripts/mysql_system_tables_data.sql | |
parent | d73f2a82245b80bba8cb41ebf06c43e7fb01791b (diff) | |
download | mariadb-git-19990c92197c64588ac489fda6c23e34702d7db0.tar.gz |
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.
Diffstat (limited to 'scripts/mysql_system_tables_data.sql')
-rw-r--r-- | scripts/mysql_system_tables_data.sql | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql index 7203e250656..82b185ebefc 100644 --- a/scripts/mysql_system_tables_data.sql +++ b/scripts/mysql_system_tables_data.sql @@ -25,8 +25,7 @@ -- Get the hostname, if the hostname has any wildcard character like "_" or "%" -- add escape character in front of wildcard character to convert "_" or "%" to -- a plain character -SET @get_hostname= @@hostname; -SELECT REPLACE((SELECT REPLACE(@get_hostname,'_','\_')),'%','\%') INTO @current_hostname; +SELECT LOWER( REPLACE((SELECT REPLACE(@@hostname,'_','\_')),'%','\%') )INTO @current_hostname; -- Fill "db" table with default grants for anyone to @@ -42,9 +41,9 @@ DROP TABLE tmp_db; -- from local machine if "user" table didn't exist before CREATE TEMPORARY TABLE tmp_user LIKE user; 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','','','','',0,0,0,0); -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','','','','',0,0,0,0 FROM dual WHERE LOWER( @current_hostname) != 'localhost'; +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','','','','',0,0,0,0 FROM dual WHERE @current_hostname != 'localhost'; 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','','','','',0,0,0,0); INSERT INTO tmp_user (host,user) VALUES ('localhost',''); -INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOWER(@current_hostname ) != 'localhost'; +INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE @current_hostname != 'localhost'; INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0; DROP TABLE tmp_user; |