-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_openstack_service_db.sh
57 lines (48 loc) · 2.62 KB
/
create_openstack_service_db.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
# author: Winnie Yang
#
#
#mysql_host=localhost
mysql_host=$(ifconfig eth0 | grep 'inet addr' | cut -d':' -f2 | sed 's/ .*//')
mysql_admin=
mysql_pw=
#
# create keystone
#
mysql -u${mysql_admin} -p${mysql_pw} -e "drop database if exists keystone"
mysql -u${mysql_admin} -p${mysql_pw} -e "delete from mysql.user where user='keystone'"
mysql -u${mysql_admin} -p${mysql_pw} -e "create database keystone"
mysql -u${mysql_admin} -p${mysql_pw} -e "grant all privileges on keystone.* to 'keystone'@localhost identified by '${mysql_pw}'"
mysql -u${mysql_admin} -p${mysql_pw} -e "grant all privileges on keystone.* to 'keystone'@'${mysql_host}' identified by '${mysql_pw}'"
#
# create glance
#
mysql -u${mysql_admin} -p${mysql_pw} -e "drop database if exists glance"
mysql -u${mysql_admin} -p${mysql_pw} -e "delete from mysql.user where user='glance'"
mysql -u${mysql_admin} -p${mysql_pw} -e "create database glance"
mysql -u${mysql_admin} -p${mysql_pw} -e "grant all privileges on glance.* to 'glance'@localhost identified by '${mysql_pw}'"
mysql -u${mysql_admin} -p${mysql_pw} -e "grant all privileges on glance.* to 'glance'@'${mysql_host}' identified by '${mysql_pw}'"
#
# create cinder
#
mysql -u${mysql_admin} -p${mysql_pw} -e "drop database if exists cinder"
mysql -u${mysql_admin} -p${mysql_pw} -e "delete from mysql.user where user='cinder'"
mysql -u${mysql_admin} -p${mysql_pw} -e "create database cinder"
mysql -u${mysql_admin} -p${mysql_pw} -e "grant all privileges on cinder.* to 'cinder'@localhost identified by '${mysql_pw}'"
mysql -u${mysql_admin} -p${mysql_pw} -e "grant all privileges on cinder.* to 'cinder'@'${mysql_host}' identified by '${mysql_pw}'"
#
# create nova
#
mysql -u${mysql_admin} -p${mysql_pw} -e "drop database if exists nova"
mysql -u${mysql_admin} -p${mysql_pw} -e "delete from mysql.user where user='nova'"
mysql -u${mysql_admin} -p${mysql_pw} -e "create database nova"
mysql -u${mysql_admin} -p${mysql_pw} -e "grant all privileges on nova.* to 'nova'@localhost identified by '${mysql_pw}'"
mysql -u${mysql_admin} -p${mysql_pw} -e "grant all privileges on nova.* to 'nova'@'${mysql_host}' identified by '${mysql_pw}'"
#
# create quantum
#
mysql -u${mysql_admin} -p${mysql_pw} -e "drop database if exists quantum"
mysql -u${mysql_admin} -p${mysql_pw} -e "delete from mysql.user where user='quantum'"
mysql -u${mysql_admin} -p${mysql_pw} -e "create database quantum"
mysql -u${mysql_admin} -p${mysql_pw} -e "grant all privileges on quantum.* to 'quantum'@localhost identified by '${mysql_pw}'"
mysql -u${mysql_admin} -p${mysql_pw} -e "grant all privileges on quantum.* to 'quantum'@'${mysql_host}' identified by '${mysql_pw}'"