summaryrefslogtreecommitdiff
path: root/mysql-test/install_test_db
diff options
context:
space:
mode:
authorunknown <sasha@mysql.sashanet.com>2000-12-07 07:54:59 -0700
committerunknown <sasha@mysql.sashanet.com>2000-12-07 07:54:59 -0700
commit1a6031856007ea2fa4c87331b4abee46edb2bf66 (patch)
treeef39d8dcdf72e86ba28a8083870495ea8e17395c /mysql-test/install_test_db
parente5c585861e6bf411fd64a18d3a08dbacf039d21a (diff)
downloadmariadb-git-1a6031856007ea2fa4c87331b4abee46edb2bf66.tar.gz
fixed up mysql-test - will not push this yet, as more clean up/testing is to follow
BitKeeper/deleted/.del-README~b8e00a1b57b91f69: ***MISSING WEAVE*** BitKeeper/deleted/.del-README~2bddc2706d0834d0: ***MISSING WEAVE*** mysql-test/r/alt000001.result: mvdir mysql-test/r/ins000001.result: mvdir mysql-test/r/rpl000001.a.result: mvdir mysql-test/r/rpl000001.b.result: mvdir mysql-test/r/rpl000002.result: mvdir mysql-test/r/rpl000003.result: mvdir mysql-test/r/rpl000004.a.result: mvdir mysql-test/r/rpl000004.b.result: mvdir mysql-test/r/rpl000005.result: mvdir mysql-test/r/rpl000006.result: mvdir mysql-test/r/rpl000007.result: mvdir mysql-test/r/rpl000008.result: mvdir mysql-test/r/rpl000009.result: mvdir mysql-test/r/rpl000010.result: mvdir mysql-test/r/rpl000011.result: mvdir mysql-test/r/rpl000012.result: mvdir mysql-test/r/rpl000012.status.result: mvdir mysql-test/r/rpl000013.result: mvdir mysql-test/r/rpl000013.status.result: mvdir mysql-test/r/sel000001.result: mvdir mysql-test/r/sel000002.result: mvdir mysql-test/r/sel000003.result: mvdir mysql-test/r/sel000004.result: mvdir mysql-test/r/sel000005.result: mvdir mysql-test/r/sel000006.result: mvdir mysql-test/r/sel000007.result: mvdir mysql-test/r/sel000008.result: mvdir mysql-test/r/sel000009.result: mvdir mysql-test/r/sel000010.result: mvdir mysql-test/r/sel000011.result: mvdir mysql-test/r/sel000012.result: mvdir mysql-test/r/sel000013.result: mvdir mysql-test/r/sel000014.result: mvdir mysql-test/r/sel000015.result: mvdir mysql-test/r/sel000016.result: mvdir mysql-test/r/sel000017.result: mvdir mysql-test/r/sel000018.result: mvdir mysql-test/r/sel000019.result: mvdir mysql-test/r/sel000020.result: mvdir mysql-test/r/sel000021.result: mvdir mysql-test/r/sel000022.result: mvdir mysql-test/r/sel000023.result: mvdir mysql-test/r/sel000024.result: mvdir mysql-test/r/sel000025.result: mvdir mysql-test/r/sel000026.result: mvdir mysql-test/r/sel000027.result: mvdir mysql-test/r/sel000028.result: mvdir mysql-test/r/sel000029.result: mvdir mysql-test/r/sel000030.result: mvdir mysql-test/r/sel000100.result: mvdir mysql-test/r/shw000001.result: mvdir mysql-test/t/README: mvdir mysql-test/t/err000001.test: mvdir mysql-test/t/rpl000007-slave.opt: mvdir mysql-test/t/rpl000008-slave.opt: mvdir mysql-test/t/rpl000009-slave.opt: mvdir mysql-test/t/rpl000010-slave.opt: mvdir mysql-test/t/rpl000013-slave.opt: mvdir BitKeeper/deleted/.del-start-mysqld~9c8f21a7ab97793a: ***MISSING WEAVE*** BitKeeper/deleted/.del-stop-mysqld~89a1194045f05d1c: ***MISSING WEAVE*** BitKeeper/deleted/.del-translate-tests~3869c1fdf0a5ea1a: ***MISSING WEAVE*** BitKeeper/deleted/.del-README~108667adaeabe3f5: ***MISSING WEAVE*** BitKeeper/deleted/.del-README~c5aaceda4c2b1a8: ***MISSING WEAVE*** BitKeeper/deleted/.del-select-key.master~e6b83af25df0ce5: ***MISSING WEAVE*** mysql-test/std_data/words.dat: Rename: mysql-test/std_data/words -> mysql-test/std_data/words.dat BitKeeper/deleted/.del-simple-select.master~6f3eb98812926caf: ***MISSING WEAVE*** Makefile.am: add mysql-test to distribution configure.in: added mysql-test libmysql/Makefile.am: include hash.h libmysql/Makefile.shared: add hash to libmysqlclient mysql-test/Makefile.am: mysql-test is now in source dist also mysql-test/chew_on_this/select.res: ***MISSING WEAVE*** mysql-test/install_test_db: renamed file, moved to different directory, and fixed up to work on binary dist mysql-test/mysql-test-run: clean-up of test suite, make it work on binary dist mysql-test/t/alt000001.test: moved directory mysql-test/t/ins000001.test: moved directory mysql-test/t/rpl000001.test: moved dir mysql-test/t/rpl000002.test: moved dir mysql-test/t/rpl000003.test: moved dir mysql-test/t/rpl000004.test: moved dir mysql-test/t/rpl000005.test: moved dir mysql-test/t/rpl000006.test: moved dir mysql-test/t/rpl000007.test: moved dir mysql-test/t/rpl000008.test: moved dir mysql-test/t/rpl000009.test: moved dir mysql-test/t/rpl000010.test: moved dir mysql-test/t/rpl000011.test: moved dir mysql-test/t/rpl000012.test: moved dir mysql-test/t/rpl000013.test: moved dir mysql-test/t/sel000001.test: moved dir mysql-test/t/sel000002.test: moved dir BitKeeper/etc/ignore: Added libmysql_r/hash.c scripts/mysql-3.23.29-gamma-pc-linux-gnu-i686.tar.gz to the ignore list mysql-test/t/sel000003.test: moved dir mysql-test/t/sel000004.test: moved dir mysql-test/t/sel000005.test: moved dir mysql-test/t/sel000100.test: moved dir mysql-test/t/shw000001.test: moved dir scripts/make_binary_distribution.sh: fixes to include mysql-test added -debug option to exit after building temp dir before tar.gz removed a bunch of SCCS files
Diffstat (limited to 'mysql-test/install_test_db')
-rwxr-xr-xmysql-test/install_test_db219
1 files changed, 219 insertions, 0 deletions
diff --git a/mysql-test/install_test_db b/mysql-test/install_test_db
new file mode 100755
index 00000000000..be037b06538
--- /dev/null
+++ b/mysql-test/install_test_db
@@ -0,0 +1,219 @@
+#!/bin/sh
+# Copyright (C) 1997, 1998, 1999 TCX DataKonsult AB & Monty Program KB & Detron HB
+# For a more info consult the file COPYRIGHT distributed with this file
+
+# This scripts creates the privilege tables db, host, user, tables_priv,
+# columns_priv in the mysql database, as well as the func table.
+
+if [ x$1 = x"-bin" ]; then
+ shift 1
+ execdir=../bin
+ bindir=../bin
+ BINARY_DIST=1
+ fix_bin=mysql-test
+else
+ execdir=../sql
+ bindir=../client
+ fix_bin=.
+fi
+
+if [ x$1 = x"-slave" ]
+then
+ shift 1
+ data=var/slave-data
+ ldata=$fix_bin/var/slave-data
+ logdir=var/log
+else
+ data=var/lib
+ ldata=$fix_bin/var/lib
+ logdir=var/log
+fi
+
+mdata=$data/mysql
+
+
+if test ! -x $execdir/mysqld
+then
+ echo "mysqld is missing - looked in $execdir"
+ exit 1
+fi
+
+# On IRIX hostname is in /usr/bsd so add this to the path
+PATH=$PATH:/usr/bsd
+hostname=`hostname` # Install this too in the user table
+
+resolved=127.0.0.1
+
+
+# Create database directories mysql & test
+if [ -d $data ] ; then rm -rf $data ; fi
+mkdir -p $data $data/mysql $data/test
+
+#for error messages
+if [ x$BINARY_DIST = x1 ] ; then
+basedir=..
+else
+basedir=.
+rm -rf share
+mkdir share
+ln -sf ../../sql/share share/mysql
+fi
+
+#create the directory for logs
+mkdir -p $logdir
+
+# Initialize variables
+c_d="" i_d=""
+c_h="" i_h=""
+c_u="" i_u=""
+c_f="" i_f=""
+c_t="" c_c=""
+
+# Check for old tables
+if test ! -f $mdata/db.frm
+then
+ # mysqld --bootstrap wants one command/line
+ c_d="$c_d CREATE TABLE db ("
+ c_d="$c_d Host char(60) DEFAULT '' NOT NULL,"
+ c_d="$c_d Db char(64) DEFAULT '' NOT NULL,"
+ c_d="$c_d User char(16) DEFAULT '' NOT NULL,"
+ c_d="$c_d Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d PRIMARY KEY Host (Host,Db,User),"
+ c_d="$c_d KEY User (User)"
+ c_d="$c_d )"
+ c_d="$c_d comment='Database privileges';"
+
+ i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y');
+ INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y');"
+fi
+
+if test ! -f $mdata/host.frm
+then
+ c_h="$c_h CREATE TABLE host ("
+ c_h="$c_h Host char(60) DEFAULT '' NOT NULL,"
+ c_h="$c_h Db char(64) DEFAULT '' NOT NULL,"
+ c_h="$c_h Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h PRIMARY KEY Host (Host,Db)"
+ c_h="$c_h )"
+ c_h="$c_h comment='Host privileges; Merged with database privileges';"
+fi
+
+if test ! -f $mdata/user.frm
+then
+ c_u="$c_u CREATE TABLE user ("
+ c_u="$c_u Host char(60) DEFAULT '' NOT NULL,"
+ c_u="$c_u User char(16) DEFAULT '' NOT NULL,"
+ c_u="$c_u Password char(16) DEFAULT '' NOT NULL,"
+ c_u="$c_u Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u File_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u PRIMARY KEY Host (Host,User)"
+ c_u="$c_u )"
+ c_u="$c_u comment='Users and global privileges';"
+
+ i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
+ INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
+
+ REPLACE INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
+ REPLACE INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
+
+ INSERT INTO user VALUES ('localhost','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N');
+ INSERT INTO user VALUES ('$hostname','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N');"
+fi
+
+if test ! -f $mdata/func.frm
+then
+ c_f="$c_f CREATE TABLE func ("
+ c_f="$c_f name char(64) DEFAULT '' NOT NULL,"
+ c_f="$c_f ret tinyint(1) DEFAULT '0' NOT NULL,"
+ c_f="$c_f dl char(128) DEFAULT '' NOT NULL,"
+ c_f="$c_f type enum ('function','aggregate') NOT NULL,"
+ c_f="$c_f PRIMARY KEY (name)"
+ c_f="$c_f )"
+ c_f="$c_f comment='User defined functions';"
+fi
+
+if test ! -f $mdata/tables_priv.frm
+then
+ c_t="$c_t CREATE TABLE tables_priv ("
+ c_t="$c_t Host char(60) DEFAULT '' NOT NULL,"
+ c_t="$c_t Db char(64) DEFAULT '' NOT NULL,"
+ c_t="$c_t User char(16) DEFAULT '' NOT NULL,"
+ c_t="$c_t Table_name char(60) DEFAULT '' NOT NULL,"
+ c_t="$c_t Grantor char(77) DEFAULT '' NOT NULL,"
+ c_t="$c_t Timestamp timestamp(14),"
+ c_t="$c_t Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,"
+ c_t="$c_t Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,"
+ c_t="$c_t PRIMARY KEY (Host,Db,User,Table_name),"
+ c_t="$c_t KEY Grantor (Grantor)"
+ c_t="$c_t )"
+ c_t="$c_t comment='Table privileges';"
+fi
+
+if test ! -f $mdata/columns_priv.frm
+then
+ c_c="$c_c CREATE TABLE columns_priv ("
+ c_c="$c_c Host char(60) DEFAULT '' NOT NULL,"
+ c_c="$c_c Db char(64) DEFAULT '' NOT NULL,"
+ c_c="$c_c User char(16) DEFAULT '' NOT NULL,"
+ c_c="$c_c Table_name char(64) DEFAULT '' NOT NULL,"
+ c_c="$c_c Column_name char(64) DEFAULT '' NOT NULL,"
+ c_c="$c_c Timestamp timestamp(14),"
+ c_c="$c_c Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,"
+ c_c="$c_c PRIMARY KEY (Host,Db,User,Table_name,Column_name)"
+ c_c="$c_c )"
+ c_c="$c_c comment='Column privileges';"
+fi
+
+if $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \
+ --basedir=$basedir --datadir=$ldata << END_OF_DATA
+use mysql;
+$c_d
+$i_d
+
+$c_h
+$i_h
+
+$c_u
+$i_u
+
+$c_f
+$i_f
+
+$c_t
+$c_c
+END_OF_DATA
+then
+ exit 0
+else
+ exit 1
+fi