Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hel-developer-guide
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Spencer Chang
hel-developer-guide
Commits
f8d45b96
Commit
f8d45b96
authored
Aug 03, 2017
by
高洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates 后端开发/database-init.md
Auto commit by GitBook Editor
parent
2845a5d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
46 deletions
+31
-46
database-init.md
后端开发/database-init.md
+31
-46
No files found.
后端开发/database-init.md
View file @
f8d45b96
...
...
@@ -12,27 +12,23 @@ max_connections=500
```
*
用管理员登陆mysql
*
创建数据库h
ap_dev与hap_prod
*
创建数据库h
el_dev
```sql
create schema hap_dev default character set utf8;
create schema hap_prod default character set utf8;
create schema hel_dev default character set utf8;
```
*
创建用户h
ap_dev,并将密码设置为hap_dev
*
创建用户h
el_dev,并将密码设置为hel_dev
```sql
CREATE USER h
ap_dev@'%' IDENTIFIED BY 'hap
_dev';
CREATE USER h
ap_dev@'localhost' IDENTIFIED BY 'hap
_dev';
CREATE USER h
el_dev@'%' IDENTIFIED BY 'hel
_dev';
CREATE USER h
el_dev@'localhost' IDENTIFIED BY 'hel
_dev';
```
*
将上面新建的h
ap_dev和hap_prod的权限全部赋予用户hap
*
将上面新建的h
el_dev权限赋予用户hel
```sql
GRANT ALL PRIVILEGES ON hap_dev.* TO hap_dev@'%';
GRANT ALL PRIVILEGES ON hap_dev.* TO hap_dev@'localhost';
GRANT ALL PRIVILEGES ON hap_prod.* TO hap_dev@'%';
GRANT ALL PRIVILEGES ON hap_prod.* TO hap_dev@'localhost';
GRANT ALL PRIVILEGES ON hel_dev.* TO hel_dev@'%';
GRANT ALL PRIVILEGES ON hel_dev.* TO hel_dev@'localhost';
flush privileges;
```
# 2. 创建数据库-Oracle
...
...
@@ -40,14 +36,14 @@ max_connections=500
*
创建表空间
```sql
CREATE BIGFILE TABLESPACE tbs_perm_h
ap
DATAFILE 'tbs_perm_h
ap
.dat'
CREATE BIGFILE TABLESPACE tbs_perm_h
el
DATAFILE 'tbs_perm_h
el
.dat'
SIZE 200M
AUTOEXTEND ON NEXT 20M MAXSIZE 500M;
```
```sql
CREATE TEMPORARY TABLESPACE tbs_temp_h
ap
TEMPFILE 'tbs_temp_h
ap
.dbf'
CREATE TEMPORARY TABLESPACE tbs_temp_h
el
TEMPFILE 'tbs_temp_h
el
.dbf'
SIZE 200M
AUTOEXTEND ON NEXT 20M MAXSIZE 500M;
```
...
...
@@ -55,23 +51,23 @@ max_connections=500
*
创建用户 schema
```sql
CREATE USER h
ap
_dev
IDENTIFIED BY h
ap
_dev
DEFAULT TABLESPACE tbs_perm_h
ap
TEMPORARY TABLESPACE tbs_temp_h
ap
QUOTA 200M on tbs_perm_h
ap
;
CREATE USER h
el
_dev
IDENTIFIED BY h
el
_dev
DEFAULT TABLESPACE tbs_perm_h
el
TEMPORARY TABLESPACE tbs_temp_h
el
QUOTA 200M on tbs_perm_h
el
;
```
*
授权
```sql
GRANT create session TO h
ap
_dev;
GRANT create table TO h
ap
_dev;
GRANT create view TO h
ap
_dev;
GRANT create any trigger TO h
ap
_dev;
GRANT create any procedure TO h
ap
_dev;
GRANT create sequence TO h
ap
_dev;
GRANT create synonym TO h
ap
_dev;
GRANT create session TO h
el
_dev;
GRANT create table TO h
el
_dev;
GRANT create view TO h
el
_dev;
GRANT create any trigger TO h
el
_dev;
GRANT create any procedure TO h
el
_dev;
GRANT create sequence TO h
el
_dev;
GRANT create synonym TO h
el
_dev;
```
# 3. 创建数据库-sql server
...
...
@@ -79,29 +75,17 @@ max_connections=500
*
创建数据库
```sql
CREATE DATABASE h
ap
_dev COLLATE Chinese_PRC_CI_AS;
CREATE DATABASE h
el
_dev COLLATE Chinese_PRC_CI_AS;
```
```sql
CREATE DATABASE hap_prod COLLATE Chinese_PRC_CI_AS
```
*
创建用户 h
ap
并授权
*
创建用户 h
el
并授权
```sql
sp_addlogin 'hap','handhapdev';
use hap_dev
go
sp_adduser 'hap','hap'
go
sp_addrolemember 'db_owner','hap'
go
```
```sql
use hap_prod
sp_addlogin 'hel','hel_dev';
use hel_dev
go
sp_adduser 'h
ap','hap
'
sp_adduser 'h
el_dev','hel_dev
'
go
sp_addrolemember 'db_owner','h
ap
'
sp_addrolemember 'db_owner','h
el
'
go
```
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment