Commit faed96fc authored by 冯景珉's avatar 冯景珉

Update database-init.md

parent 528ca4d4
......@@ -12,23 +12,23 @@ max_connections=500
```
* 用管理员登陆mysql
* 创建数据库hel_dev
* 创建数据库hls_dev
```sql
create schema hel_dev default character set utf8;
create schema hls_dev default character set utf8;
```
* 创建用户hel_dev,并将密码设置为hel_dev
* 创建用户hls_dev,并将密码设置为hls_dev
```sql
CREATE USER hel_dev@'%' IDENTIFIED BY 'hel_dev';
CREATE USER hel_dev@'localhost' IDENTIFIED BY 'hel_dev';
CREATE USER hls_dev@'%' IDENTIFIED BY 'hls_dev';
CREATE USER hls_dev@'localhost' IDENTIFIED BY 'hls_dev';
```
* 将上面新建的hel_dev权限赋予用户hel
* 将上面新建的hls_dev权限赋予用户hls
```sql
GRANT ALL PRIVILEGES ON hel_dev.* TO hel_dev@'%';
GRANT ALL PRIVILEGES ON hel_dev.* TO hel_dev@'localhost';
GRANT ALL PRIVILEGES ON hls_dev.* TO hls_dev@'%';
GRANT ALL PRIVILEGES ON hls_dev.* TO hls_dev@'localhost';
flush privileges;
```
# 2. 创建数据库-Oracle
......@@ -36,14 +36,14 @@ max_connections=500
* 创建表空间
```sql
CREATE BIGFILE TABLESPACE tbs_perm_hel
DATAFILE 'tbs_perm_hel.dat'
CREATE BIGFILE TABLESPACE tbs_perm_hls
DATAFILE 'tbs_perm_hls.dat'
SIZE 200M
AUTOEXTEND ON NEXT 20M MAXSIZE 500M;
```
```sql
CREATE TEMPORARY TABLESPACE tbs_temp_hel
TEMPFILE 'tbs_temp_hel.dbf'
CREATE TEMPORARY TABLESPACE tbs_temp_hls
TEMPFILE 'tbs_temp_hls.dbf'
SIZE 200M
AUTOEXTEND ON NEXT 20M MAXSIZE 500M;
```
......@@ -51,23 +51,23 @@ max_connections=500
* 创建用户 schema
```sql
CREATE USER hel_dev
IDENTIFIED BY hel_dev
DEFAULT TABLESPACE tbs_perm_hel
TEMPORARY TABLESPACE tbs_temp_hel
QUOTA 200M on tbs_perm_hel;
CREATE USER hls_dev
IDENTIFIED BY hls_dev
DEFAULT TABLESPACE tbs_perm_hls
TEMPORARY TABLESPACE tbs_temp_hls
QUOTA 200M on tbs_perm_hls;
```
* 授权
```sql
GRANT create session TO hel_dev;
GRANT create table TO hel_dev;
GRANT create view TO hel_dev;
GRANT create any trigger TO hel_dev;
GRANT create any procedure TO hel_dev;
GRANT create sequence TO hel_dev;
GRANT create synonym TO hel_dev;
GRANT create session TO hls_dev;
GRANT create table TO hls_dev;
GRANT create view TO hls_dev;
GRANT create any trigger TO hls_dev;
GRANT create any procedure TO hls_dev;
GRANT create sequence TO hls_dev;
GRANT create synonym TO hls_dev;
```
# 3. 创建数据库-sql server
......@@ -75,17 +75,17 @@ max_connections=500
* 创建数据库
```sql
CREATE DATABASE hel_dev COLLATE Chinese_PRC_CI_AS;
CREATE DATABASE hls_dev COLLATE Chinese_PRC_CI_AS;
```
* 创建用户 hel 并授权
* 创建用户 hls 并授权
```sql
sp_addlogin 'hel','hel_dev';
use hel_dev
sp_addlogin 'hls','hls_dev';
use hls_dev
go
sp_adduser 'hel_dev','hel_dev'
sp_adduser 'hls_dev','hls_dev'
go
sp_addrolemember 'db_owner','hel'
sp_addrolemember 'db_owner','hls'
go
```
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment