forked from simonellistonball/cloudbreak-hcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb_setup.sh
More file actions
executable file
·33 lines (26 loc) · 979 Bytes
/
db_setup.sh
File metadata and controls
executable file
·33 lines (26 loc) · 979 Bytes
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
#!/bin/bash
# Setup the metron rest database
yum install -y mysql-server
service mysqld start
cat <<-EOF | mysql -u root
CREATE DATABASE IF NOT EXISTS metron;
GRANT ALL PRIVILEGES ON metron.* TO 'metron'@'%' identified by 'metron';
GRANT ALL PRIVILEGES ON metron.* TO 'metron'@'localhost' identified by 'metron';
use metron;
create table if not exists users(
username varchar(50) not null primary key,
password varchar(50) not null,
enabled boolean not null
);
create table authorities (
username varchar(50) not null,
authority varchar(50) not null,
constraint fk_authorities_users foreign key(username) references
users(username)
);
create unique index ix_auth_username on authorities (username,authority);
insert into users (username, password, enabled) values ('admin', 'admin',1);
insert into authorities (username, authority) values ('admin', 'ROLE_USER');
insert into authorities (username, authority) values ('admin', 'ROLE_ADMIN');
FLUSH PRIVILEGES;
EOF