diff -ur mysql-5.1.22-rc.org/scripts/mysql_system_tables_data.sql mysql-5.1.22-rc/scripts/mysql_system_tables_data.sql
--- mysql-5.1.22-rc.org/scripts/mysql_system_tables_data.sql 2007-09-24 12:29:43.000000000 +0200
+++ mysql-5.1.22-rc/scripts/mysql_system_tables_data.sql 2007-11-24 20:22:08.360937978 +0100
-@@ -2,20 +2,14 @@
- -- The inital data for system tables of MySQL Server
- --
+@@ -7,23 +7,16 @@
+ -- containing "@current_hostname" are filtered out by mysql_install_db.
+ set @current_hostname= @@hostname;
+-
--- Fill "db" table with default grants for anyone to
--- access database 'test' and 'test_%' if "db" table didn't exist
-CREATE TEMPORARY TABLE tmp_db LIKE db;
-DROP TABLE tmp_db;
-
-
---- Fill "users" table with default users allowing root access
-+-- Fill "users" table with default users allowing mysql access
+ -- Fill "users" table with default users allowing root access
-- from local machine if "users" table didn't exist before
CREATE TEMPORARY TABLE tmp_user LIKE user;
+ set @current_hostname= @@hostname;
-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 VALUES (@@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);
+-REPLACE INTO tmp_user VALUES (@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);
-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 VALUES ('localhost','mysql','','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 VALUES (@@hostname,'mysql','','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 VALUES (@current_hostname,'mysql','','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 VALUES ('127.0.0.1','mysql','','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 VALUES ('localhost','mysql_sysadmin','','N','N','N','N','N','N','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0);
-+REPLACE INTO tmp_user VALUES (@@hostname,'mysql_sysadmin','','N','N','N','N','N','N','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0);
++REPLACE INTO tmp_user VALUES (@current_hostname,'mysql_sysadmin','','N','N','N','N','N','N','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0);
+REPLACE INTO tmp_user VALUES ('127.0.0.1','mysql_sysadmin','','N','N','N','N','N','N','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0);
+ INSERT INTO tmp_user (host,user) VALUES ('localhost','');
+ INSERT INTO tmp_user (host,user) VALUES (@current_hostname,'');
INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0;
- DROP TABLE tmp_user;
+
static DYNAMIC_STRING ds_args;
-@@ -349,91 +349,6 @@
- DBUG_RETURN(ret);
- }
-
--
--/*
-- Look for the tool in the same directory as mysql_upgrade.
--
-- When running in a not yet installed build the the program
-- will exist but it need to be invoked via it's libtool wrapper.
-- Check if the found tool can executed and if not look in the
-- directory one step higher up where the libtool wrapper normally
-- is found
--*/
--
--static void find_tool(char *tool_path, const char *tool_name)
--{
-- char path[FN_REFLEN];
-- DYNAMIC_STRING ds_tmp;
-- DBUG_ENTER("find_tool");
-- DBUG_PRINT("enter", ("progname: %s", my_progname));
--
-- if (init_dynamic_string(&ds_tmp, "", 32, 32))
-- die("Out of memory");
--
-- /* Initialize path with the full path to this program */
-- if (get_full_path_to_executable(path))
-- {
-- /*
-- Easy way to get full executable path failed, try
-- other methods
-- */
-- if (my_progname[0] == FN_LIBCHAR)
-- {
-- /* 1. my_progname contains full path */
-- strmake(path, my_progname, FN_REFLEN);
-- }
-- else if (my_progname[0] == '.')
-- {
-- /* 2. my_progname contains relative path, prepend wd */
-- char buf[FN_REFLEN];
-- my_getwd(buf, FN_REFLEN, MYF(0));
-- my_snprintf(path, FN_REFLEN, "%s%s", buf, my_progname);
-- }
-- else
-- {
-- /* 3. Just go for it and hope tool is in path */
-- path[0]= 0;
-- }
-- }
-- do
-- {
-- size_t path_len;
-- DBUG_PRINT("enter", ("path: %s", path));
--
-- /* Chop off last char(since it might be a /) */
-- path[max((strlen(path)-1), 0)]= 0;
--
-- /* Chop off last dir part */
-- dirname_part(path, path, &path_len);
--
-- /* Format name of the tool to search for */
-- fn_format(tool_path, tool_name,
-- path, "", MYF(MY_REPLACE_DIR));
--
-- verbose("Looking for '%s' in: %s", tool_name, tool_path);
--
-- /* Make sure the tool exists */
-- if (my_access(tool_path, F_OK) != 0)
-- die("Can't find '%s'", tool_path);
--
-- /*
-- Make sure it can be executed, otherwise try again
-- in higher level directory
-- */
-- }
-- while(run_tool(tool_path,
-- &ds_tmp, /* Get output from command, discard*/
-- "--help",
-- "2>&1",
-- IF_WIN("> NUL", "> /dev/null"),
-- NULL));
--
-- dynstr_free(&ds_tmp);
--
-- DBUG_VOID_RETURN;
--}
--
--
- /*
- Run query using "mysql"
- */
@@ -758,12 +673,6 @@
dynstr_append_os_quoted(&ds_args, "--user=", opt_user, NullS);
dynstr_append(&ds_args, " ");