summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-10-09 10:30:11 +0200
committerSergei Golubchik <sergii@pisem.net>2014-10-09 10:30:11 +0200
commit1b75bed00fa4ea3925f513f4825deb00cb158d5b (patch)
tree0822ed2a2ca42ba1acb82a6737336bbfe219bebe /scripts
parent689ffe3559a4b7bacd13503ba93659b2f4560bbb (diff)
parentb2d71434ed24d0901155fe68b0b7ee4fdad0e2d4 (diff)
downloadmariadb-git-1b75bed00fa4ea3925f513f4825deb00cb158d5b.tar.gz
5.5.40+ merge
Diffstat (limited to 'scripts')
-rw-r--r--scripts/comp_sql.c1
-rw-r--r--scripts/mysql_system_tables_fix.sql17
2 files changed, 18 insertions, 0 deletions
diff --git a/scripts/comp_sql.c b/scripts/comp_sql.c
index 20dedfdfa14..bcc653a3b7f 100644
--- a/scripts/comp_sql.c
+++ b/scripts/comp_sql.c
@@ -23,6 +23,7 @@
into other programs
*/
+#include <my_config.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index 49a9062e13e..9e74eed4298 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -645,6 +645,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;