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
faed96fc
Commit
faed96fc
authored
Sep 15, 2017
by
冯景珉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update database-init.md
parent
528ca4d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
30 deletions
+31
-30
database-init.md
后端开发/database-init.md
+31
-30
No files found.
后端开发/database-init.md
View file @
faed96fc
...
@@ -12,23 +12,23 @@ max_connections=500
...
@@ -12,23 +12,23 @@ max_connections=500
```
```
*
用管理员登陆mysql
*
用管理员登陆mysql
*
创建数据库h
el
_dev
*
创建数据库h
ls
_dev
```sql
```sql
create schema h
el
_dev default character set utf8;
create schema h
ls
_dev default character set utf8;
```
```
*
创建用户h
el_dev,并将密码设置为hel
_dev
*
创建用户h
ls_dev,并将密码设置为hls
_dev
```sql
```sql
CREATE USER h
el_dev@'%' IDENTIFIED BY 'hel
_dev';
CREATE USER h
ls_dev@'%' IDENTIFIED BY 'hls
_dev';
CREATE USER h
el_dev@'localhost' IDENTIFIED BY 'hel
_dev';
CREATE USER h
ls_dev@'localhost' IDENTIFIED BY 'hls
_dev';
```
```
*
将上面新建的h
el_dev权限赋予用户hel
*
将上面新建的h
ls_dev权限赋予用户hls
```sql
```sql
GRANT ALL PRIVILEGES ON h
el_dev.* TO hel
_dev@'%';
GRANT ALL PRIVILEGES ON h
ls_dev.* TO hls
_dev@'%';
GRANT ALL PRIVILEGES ON h
el_dev.* TO hel
_dev@'localhost';
GRANT ALL PRIVILEGES ON h
ls_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_h
el
CREATE BIGFILE TABLESPACE tbs_perm_h
ls
DATAFILE 'tbs_perm_h
el
.dat'
DATAFILE 'tbs_perm_h
ls
.dat'
SIZE 200M
SIZE 200M
AUTOEXTEND ON NEXT 20M MAXSIZE 500M;
AUTOEXTEND ON NEXT 20M MAXSIZE 500M;
```
```
```sql
```sql
CREATE TEMPORARY TABLESPACE tbs_temp_h
el
CREATE TEMPORARY TABLESPACE tbs_temp_h
ls
TEMPFILE 'tbs_temp_h
el
.dbf'
TEMPFILE 'tbs_temp_h
ls
.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 h
el
_dev
CREATE USER h
ls
_dev
IDENTIFIED BY h
el
_dev
IDENTIFIED BY h
ls
_dev
DEFAULT TABLESPACE tbs_perm_h
el
DEFAULT TABLESPACE tbs_perm_h
ls
TEMPORARY TABLESPACE tbs_temp_h
el
TEMPORARY TABLESPACE tbs_temp_h
ls
QUOTA 200M on tbs_perm_h
el
;
QUOTA 200M on tbs_perm_h
ls
;
```
```
*
授权
*
授权
```sql
```sql
GRANT create session TO h
el
_dev;
GRANT create session TO h
ls
_dev;
GRANT create table TO h
el
_dev;
GRANT create table TO h
ls
_dev;
GRANT create view TO h
el
_dev;
GRANT create view TO h
ls
_dev;
GRANT create any trigger TO h
el
_dev;
GRANT create any trigger TO h
ls
_dev;
GRANT create any procedure TO h
el
_dev;
GRANT create any procedure TO h
ls
_dev;
GRANT create sequence TO h
el
_dev;
GRANT create sequence TO h
ls
_dev;
GRANT create synonym TO h
el
_dev;
GRANT create synonym TO h
ls
_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 h
el
_dev COLLATE Chinese_PRC_CI_AS;
CREATE DATABASE h
ls
_dev COLLATE Chinese_PRC_CI_AS;
```
```
*
创建用户 h
el
并授权
*
创建用户 h
ls
并授权
```sql
```sql
sp_addlogin 'h
el','hel
_dev';
sp_addlogin 'h
ls','hls
_dev';
use h
el
_dev
use h
ls
_dev
go
go
sp_adduser 'h
el_dev','hel
_dev'
sp_adduser 'h
ls_dev','hls
_dev'
go
go
sp_addrolemember 'db_owner','h
el
'
sp_addrolemember 'db_owner','h
ls
'
go
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