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

Update database-init.md

parent 528ca4d4
...@@ -12,23 +12,23 @@ max_connections=500 ...@@ -12,23 +12,23 @@ max_connections=500
``` ```
* 用管理员登陆mysql * 用管理员登陆mysql
* 创建数据库hel_dev * 创建数据库hls_dev
```sql ```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 ```sql
CREATE USER hel_dev@'%' IDENTIFIED BY 'hel_dev'; CREATE USER hls_dev@'%' IDENTIFIED BY 'hls_dev';
CREATE USER hel_dev@'localhost' IDENTIFIED BY 'hel_dev'; CREATE USER hls_dev@'localhost' IDENTIFIED BY 'hls_dev';
``` ```
* 将上面新建的hel_dev权限赋予用户hel * 将上面新建的hls_dev权限赋予用户hls
```sql ```sql
GRANT ALL PRIVILEGES ON hel_dev.* TO hel_dev@'%'; GRANT ALL PRIVILEGES ON hls_dev.* TO hls_dev@'%';
GRANT ALL PRIVILEGES ON hel_dev.* TO hel_dev@'localhost'; GRANT ALL PRIVILEGES ON hls_dev.* TO hls_dev@'localhost';
flush privileges; flush privileges;
``` ```
# 2. 创建数据库-Oracle # 2. 创建数据库-Oracle
...@@ -36,14 +36,14 @@ max_connections=500 ...@@ -36,14 +36,14 @@ max_connections=500
* 创建表空间 * 创建表空间
```sql ```sql
CREATE BIGFILE TABLESPACE tbs_perm_hel CREATE BIGFILE TABLESPACE tbs_perm_hls
DATAFILE 'tbs_perm_hel.dat' DATAFILE 'tbs_perm_hls.dat'
SIZE 200M SIZE 200M
AUTOEXTEND ON NEXT 20M MAXSIZE 500M; AUTOEXTEND ON NEXT 20M MAXSIZE 500M;
``` ```
```sql ```sql
CREATE TEMPORARY TABLESPACE tbs_temp_hel CREATE TEMPORARY TABLESPACE tbs_temp_hls
TEMPFILE 'tbs_temp_hel.dbf' TEMPFILE 'tbs_temp_hls.dbf'
SIZE 200M SIZE 200M
AUTOEXTEND ON NEXT 20M MAXSIZE 500M; AUTOEXTEND ON NEXT 20M MAXSIZE 500M;
``` ```
...@@ -51,23 +51,23 @@ max_connections=500 ...@@ -51,23 +51,23 @@ max_connections=500
* 创建用户 schema * 创建用户 schema
```sql ```sql
CREATE USER hel_dev CREATE USER hls_dev
IDENTIFIED BY hel_dev IDENTIFIED BY hls_dev
DEFAULT TABLESPACE tbs_perm_hel DEFAULT TABLESPACE tbs_perm_hls
TEMPORARY TABLESPACE tbs_temp_hel TEMPORARY TABLESPACE tbs_temp_hls
QUOTA 200M on tbs_perm_hel; QUOTA 200M on tbs_perm_hls;
``` ```
* 授权 * 授权
```sql ```sql
GRANT create session TO hel_dev; GRANT create session TO hls_dev;
GRANT create table TO hel_dev; GRANT create table TO hls_dev;
GRANT create view TO hel_dev; GRANT create view TO hls_dev;
GRANT create any trigger TO hel_dev; GRANT create any trigger TO hls_dev;
GRANT create any procedure TO hel_dev; GRANT create any procedure TO hls_dev;
GRANT create sequence TO hel_dev; GRANT create sequence TO hls_dev;
GRANT create synonym TO hel_dev; GRANT create synonym TO hls_dev;
``` ```
# 3. 创建数据库-sql server # 3. 创建数据库-sql server
...@@ -75,17 +75,17 @@ max_connections=500 ...@@ -75,17 +75,17 @@ max_connections=500
* 创建数据库 * 创建数据库
```sql ```sql
CREATE DATABASE hel_dev COLLATE Chinese_PRC_CI_AS; CREATE DATABASE hls_dev COLLATE Chinese_PRC_CI_AS;
``` ```
* 创建用户 hel 并授权 * 创建用户 hls 并授权
```sql ```sql
sp_addlogin 'hel','hel_dev'; sp_addlogin 'hls','hls_dev';
use hel_dev use hls_dev
go go
sp_adduser 'hel_dev','hel_dev' sp_adduser 'hls_dev','hls_dev'
go go
sp_addrolemember 'db_owner','hel' sp_addrolemember 'db_owner','hls'
go 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