moved z3950 scripts to z3950daemon subdir within scripts dir in tarball
[koha.git] / databaseinstall.sh
1 #!/bin/sh
2
3 if [ $# = 4 ]; then
4   echo Setting up database
5   mysqladmin -uroot -p$1 create $2
6   echo creating tables
7   mysql -uroot -p$1 $2 < koha.mysql
8   echo creating mysql permissions
9   mysql -uroot -p$1 mysql -e "insert into user (Host,User,Password) values ('localhost','$3',password('$4'))";
10   mysql -uroot -p$1 mysql -e "insert into db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv) values ('%','$2','$3','Y','Y','Y','Y')";
11   mysqladmin -uroot -p$1 reload
12   echo 
13   echo If no errors were reported, the database will be set up
14   echo You can check by typing mysql -u$3 -p$4 $2
15   echo then show tables;
16   echo
17   echo You will need to Edit C4/Database.pm to reflect the username,database and password you have chosen
18   
19 else
20   echo This scripts needs four inputs, 
21   echo The root password for mysql, the database for use with koha, the username for use with koha and the password
22   echo For example databaseinstall.sh fish koha kohauser tuna
23 fi