mysql:71
From: Isamu Seko <Isamu Seko <isamu@xxxxxxxxxx>>
Date: Thu, 05 Mar 1998 04:08:38 +0900
Subject: [mysql 71] create sql
#!/bin/sh
# Copyright (C) 1997 TCX DataKonsult AB & Monty Program KB & Detron HB
# For a more info consult the file COPYRIGHT distributed with this file
# This scripts creates the privilige tables db, host, user in mysql
# It should be run from the top level installation directory
if test -f /var/db/mysql/mysql/db.ISM
then
echo "mysql privilege databases already installed. If you want to recreate all"
echo "privilige tables, execute 'rm -i /var/db/mysql/mysql/*.IS?'"
echo "and run this script again"
exit 1
fi
if test ! -x /usr/local/bin/mysqladmin
then
echo "Can't execute /usr/local/bin/mysqladmin"
if test "/var/db/mysql" = "./data"
then
echo "You should be in the distribution directory when executing this script"
else
echo "You should do a 'make install' before executing this script"
fi
exit 1
fi
if test ! -d "./data"
then
echo "You should be in the distribution directory when executing this script"
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
# create database mysql & test
#
mkdir /var/db/mysql
mkdir /var/db/mysql/mysql
mkdir /var/db/mysql/test
/usr/local/bin/mysqladmin ver > /dev/null 2>&1
if test $? -eq 0
then
echo "mysql demon is running. Stop it and try again"
exit 1;
else
echo "Starting mysql server"
/usr/local/bin/safe_mysqld -Sg -l &
while true
do
sleep 1 # This should be enough
/usr/local/bin/mysqladmin ver > /dev/null 2>&1
if test $? -eq 0 ; then break; fi
sleep 5; # This must be enough
/usr/local/bin/mysqladmin ver > /dev/null 2>&1
if test $? -eq 0 ; then break; fi
echo "mysql demon is not responding. Please try to start it manually with -Sg"
exit 1;
done
fi
# copy the definition files
#
if test "/var/db/mysql" != "./data"
then
cp -p ./data/mysql/*.frm /var/db/mysql/mysql
fi
/usr/local/bin/mysql mysql <<END_OF_DATA
# Create tables from the .frm files
#
delete from db ;
delete from host;
delete from user;
#
# Dumping data for table 'db'
#
INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y');
#
# Dumping data for table 'host'
#
INSERT INTO host VALUES ('localhost','%','Y','Y','Y','Y','Y','Y');
INSERT INTO host VALUES ('$hostname','%','Y','Y','Y','Y','Y','Y');
#
# Dumping data for table 'user'
#
INSERT INTO user VALUES ('localhost','root','','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');
INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
INSERT INTO user VALUES ('$hostname','','','N','N','N','N','N','N','N','N','N','N');
END_OF_DATA
/usr/local/bin/mysqladmin reload
echo "mysqld demon is running and mysql grant tables are installed"
-> 71 1998-03-05 04:08 [Isamu Seko <isamu@xx] create sql 72 1998-03-05 09:02 ┣[<takeshi@xxxxxxxxxx>] 74 1998-03-05 09:38 ┗[民斗 <tommy@xxxxxxxx]