summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2014-10-09 17:25:08 -0400
committerNirbhay Choubey <nirbhay@mariadb.com>2014-10-09 17:25:08 -0400
commit068fb8569f2300e4a5c08413a756417d923ecf5f (patch)
treeab008f1be51ee322cbeeb5aa73042430a6e63347 /scripts
parent59277a7d83374bc293cd58f8be509a81792d829e (diff)
parentdbda20caffbb22115b6f30069b716bc505c49d11 (diff)
downloadmariadb-git-068fb8569f2300e4a5c08413a756417d923ecf5f.tar.gz
bzr merge -rtag:mariadb-5.5.40 maria/5.5
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mysql_system_tables_fix.sql17
-rw-r--r--scripts/mysqlhotcopy.sh3
2 files changed, 20 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;
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index 1ef743725e5..b6ff7e1b28d 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -56,6 +56,9 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome.
# Documentation continued at end of file
+# fix CORE::GLOBAL::die to return a predictable exit code
+BEGIN { *CORE::GLOBAL::die= sub { warn @_; exit 1; }; }
+
my $VERSION = "1.23";
my $opt_tmpdir = $ENV{TMPDIR} || "/tmp";