[Openhive-discuss] Script to create openhive database.
Status: Beta
Brought to you by:
bryce
|
From: cliff w. <cl...@ea...> - 2005-06-07 22:44:29
|
This is a script for dummies like me..
Starting from a fresh MySQL install, it creates
all the users, and makes the db ready to run the
database.sql
Can someone add to CVS?
cliffw
------------Start create_db_users.sh---------------
#!/bin/bash
set -x
# This is a script to create the openhive database administrator,
# with the proper logins and passwords.
# alter to suit your needs
# Cliffw White 2005
# Licensed under the GPL, see the file COPYING for details.
# We will use 'openhive' for our database user
# We will add a 'mysql' user also
# Most of this comes from the MySQL manual
root_user="root"
oh_user="openhive"
admin_user="mysql"
db="openhive"
# this should be a big secret!
admin_pw="mysql"
oh_pw="openhive"
host=`/bin/hostname`
# secure the root user!
mysql --user="$root_user" -e "set password for 'root'@'localhost' = PASSWORD('$admin_pw');"
mysql --user="$root_user" --password="$admin_pw" -e "set password for 'root'@'$host' = PASSWORD('$admin_pw');"
# create the admin user
mysql --user="$root_user" --password="$admin_pw" -e "grant all privileges on *.* to 'mysql'@'localhost' IDENTIFIED by '$admin_pw'with GRANT OPTION;"
mysql --user="$root_user" --password="$admin_pw" -e "grant all privileges on *.* to 'mysql'@'%' IDENTIFIED by '$admin_pw'with GRANT OPTION;"
# create the openhive db
mysql --user="$root_user" --password="$admin_pw" -e "create database $db;"
# create the openhive user
mysql --user="$root_user" --password="$admin_pw" --database="$db" -e "grant all privileges on $db.* to '$oh_user'@'localhost' identified by '$oh_pw';"
mysql --user="$root_user" --password="$admin_pw" --database="$db" -e "grant all privileges on $db.* to '$oh_user'@'%' identified by '$oh_pw';"
--------------end-------------------
|