diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-10-06 19:53:55 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-10-06 19:53:55 +0200 |
commit | 1ddfce4840994b6b79a3f426fcedf8f0469334ac (patch) | |
tree | 4a5700c90dacb63f00a8d130e94ba0398b2ee371 /scripts/mysql_system_tables_fix.sql | |
parent | c0977073e18d070810c20026defc63794154e288 (diff) | |
parent | 3139aa87b4f215418740939cc8d156150c355823 (diff) | |
download | mariadb-git-1ddfce4840994b6b79a3f426fcedf8f0469334ac.tar.gz |
mysql-5.5.40
Diffstat (limited to 'scripts/mysql_system_tables_fix.sql')
-rw-r--r-- | scripts/mysql_system_tables_fix.sql | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index bcd3ef2005f..9bc61f38cea 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -668,6 +668,23 @@ INSERT INTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now( INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0; DROP TABLE tmp_proxies_priv; +-- Checking for any duplicate hostname and username combination are exists. +-- If exits we will throw error. +DROP PROCEDURE IF EXISTS mysql.count_duplicate_host_names; +DELIMITER // +CREATE PROCEDURE mysql.count_duplicate_host_names() +BEGIN + SET @duplicate_hosts=(SELECT count(*) FROM mysql.user GROUP BY user, lower(host) HAVING count(*) > 1 LIMIT 1); + IF @duplicate_hosts > 1 THEN + SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Multiple accounts exist for @user_name, @host_name that differ only in Host lettercase; remove all except one of them'; + END IF; +END // +DELIMITER ; +CALL mysql.count_duplicate_host_names(); +-- Get warnings (if any) +SHOW WARNINGS; +DROP PROCEDURE mysql.count_duplicate_host_names; + # Convering the host name to lower case for existing users UPDATE user SET host=LOWER( host ) WHERE LOWER( host ) <> host; |