2000-07-31 21:29:14 +02:00
|
|
|
#!/bin/sh
|
2006-11-09 17:43:31 +01:00
|
|
|
# Copyright (C) 1997-2006 MySQL AB
|
2006-12-31 01:02:27 +01:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; version 2 of the License.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2000-07-31 21:29:14 +02:00
|
|
|
|
|
|
|
# This scripts creates the privilege tables db, host, user, tables_priv,
|
|
|
|
# columns_priv in the mysql database, as well as the func table.
|
|
|
|
|
2004-03-12 00:10:22 +01:00
|
|
|
if [ x$1 = x"--bin" ]; then
|
2004-03-16 21:41:30 +01:00
|
|
|
shift 1
|
2006-11-09 17:43:31 +01:00
|
|
|
BINARY_DIST=1
|
|
|
|
|
|
|
|
bindir=../bin
|
2007-03-16 17:28:32 +01:00
|
|
|
scriptdir=bin
|
2006-11-09 17:43:31 +01:00
|
|
|
libexecdir=../libexec
|
2004-03-16 21:41:30 +01:00
|
|
|
|
|
|
|
# Check if it's a binary distribution or a 'make install'
|
|
|
|
if test -x ../libexec/mysqld
|
|
|
|
then
|
|
|
|
execdir=../libexec
|
2006-11-09 17:43:31 +01:00
|
|
|
elif test -x ../../sbin/mysqld # RPM installation
|
|
|
|
then
|
|
|
|
execdir=../../sbin
|
|
|
|
bindir=../../bin
|
2007-03-16 17:28:32 +01:00
|
|
|
scriptdir=../bin
|
2006-11-09 17:43:31 +01:00
|
|
|
libexecdir=../../libexec
|
2004-03-16 21:41:30 +01:00
|
|
|
else
|
|
|
|
execdir=../bin
|
|
|
|
fi
|
|
|
|
fix_bin=mysql-test
|
2000-12-07 15:54:59 +01:00
|
|
|
else
|
2004-03-16 21:41:30 +01:00
|
|
|
execdir=../sql
|
|
|
|
bindir=../client
|
|
|
|
fix_bin=.
|
2007-03-16 17:28:32 +01:00
|
|
|
scriptdir=scripts
|
2004-03-16 21:41:30 +01:00
|
|
|
libexecdir=../libexec
|
2000-12-07 15:54:59 +01:00
|
|
|
fi
|
2000-07-31 21:29:14 +02:00
|
|
|
|
2000-12-28 18:25:41 +01:00
|
|
|
vardir=var
|
|
|
|
logdir=$vardir/log
|
2000-11-18 07:35:40 +01:00
|
|
|
if [ x$1 = x"-slave" ]
|
2000-07-31 21:29:14 +02:00
|
|
|
then
|
2000-12-07 15:54:59 +01:00
|
|
|
shift 1
|
|
|
|
data=var/slave-data
|
|
|
|
ldata=$fix_bin/var/slave-data
|
2000-11-18 07:35:40 +01:00
|
|
|
else
|
2004-09-28 19:04:30 +02:00
|
|
|
if [ x$1 = x"-1" ]
|
|
|
|
then
|
|
|
|
data=var/master-data1
|
|
|
|
else
|
|
|
|
data=var/master-data
|
|
|
|
fi
|
|
|
|
ldata=$fix_bin/$data
|
2000-07-31 21:29:14 +02:00
|
|
|
fi
|
|
|
|
|
2000-12-07 15:54:59 +01:00
|
|
|
mdata=$data/mysql
|
2001-06-25 10:35:22 +02:00
|
|
|
EXTRA_ARG=""
|
2000-12-07 15:54:59 +01:00
|
|
|
|
2007-01-10 03:22:01 +01:00
|
|
|
mysqld=
|
|
|
|
if test -x $execdir/mysqld
|
2000-07-31 21:29:14 +02:00
|
|
|
then
|
2007-01-10 03:22:01 +01:00
|
|
|
mysqld=$execdir/mysqld
|
|
|
|
else
|
2003-11-25 14:43:15 +01:00
|
|
|
if test ! -x $libexecdir/mysqld
|
|
|
|
then
|
|
|
|
echo "mysqld is missing - looked in $execdir and in $libexecdir"
|
|
|
|
exit 1
|
|
|
|
else
|
2007-01-10 03:22:01 +01:00
|
|
|
mysqld=$libexecdir/mysqld
|
2003-11-25 14:43:15 +01:00
|
|
|
fi
|
2000-07-31 21:29:14 +02:00
|
|
|
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
|
2001-01-04 01:56:38 +01:00
|
|
|
hostname="$hostname%" # Fix if not fully qualified hostname
|
2000-07-31 21:29:14 +02:00
|
|
|
|
2000-11-18 07:35:40 +01:00
|
|
|
|
2000-12-28 18:25:41 +01:00
|
|
|
#create the directories
|
|
|
|
[ -d $vardir ] || mkdir $vardir
|
|
|
|
[ -d $logdir ] || mkdir $logdir
|
|
|
|
|
2000-07-31 21:29:14 +02:00
|
|
|
# Create database directories mysql & test
|
2000-12-07 15:54:59 +01:00
|
|
|
if [ -d $data ] ; then rm -rf $data ; fi
|
2000-12-28 18:25:41 +01:00
|
|
|
mkdir $data $data/mysql $data/test
|
2000-07-31 21:29:14 +02:00
|
|
|
|
2000-10-10 00:41:21 +02:00
|
|
|
#for error messages
|
2000-12-07 15:54:59 +01:00
|
|
|
if [ x$BINARY_DIST = x1 ] ; then
|
|
|
|
basedir=..
|
|
|
|
else
|
|
|
|
basedir=.
|
2007-03-16 17:28:32 +01:00
|
|
|
EXTRA_ARG="--windows"
|
2000-12-07 15:54:59 +01:00
|
|
|
fi
|
2000-10-10 00:41:21 +02:00
|
|
|
|
2007-03-16 17:28:32 +01:00
|
|
|
INSTALL_CMD="$scriptdir/mysql_install_db --no-defaults $EXTRA_ARG --basedir=$basedir --datadir=mysql-test/$ldata --srcdir=."
|
|
|
|
echo "running $INSTALL_CMD"
|
2007-01-10 03:22:01 +01:00
|
|
|
|
2007-03-16 17:28:32 +01:00
|
|
|
cd ..
|
|
|
|
if $INSTALL_CMD
|
2000-07-31 21:29:14 +02:00
|
|
|
then
|
|
|
|
exit 0
|
|
|
|
else
|
2002-05-03 22:52:36 +02:00
|
|
|
echo "Error executing mysqld --bootstrap"
|
2000-07-31 21:29:14 +02:00
|
|
|
exit 1
|
|
|
|
fi
|