티스토리 뷰

728x90

출처 : http://www.davidpashley.com/articles/postgresql-user-administration.html
http://www.faqs.org/docs/ppbook/x17149.htm

0. DB 콘솔 로그인

C:\pgsql\bin>psql -U postgres template1
psql (8.4.0)
Type "help" for help.

1. 사용자 관리

1-1. 사용자 추가

template1=# CREATE USER scott WITH PASSWORD 'tiger';
CREATE ROLE

1-2. 사용자 조회

template1=# select * from pg_shadow;
 usename  | usesysid | usecreatedb | usesuper | usecatupd | passwd | valuntil | useconfig
----------+----------+-------------+----------+-----------+--------+----------+-----------
 postgres |       10 | t           | t        | t         |        |          |
 scott    |    16384 | f           | f        | f         | f91290 |          |
(2 rows)

template1=# select * from pg_user;
 usename  | usesysid | usecreatedb | usesuper | usecatupd |  passwd  | valuntil| useconfig
----------+----------+-------------+----------+-----------+----------+----------+-----------
 postgres |       10 | t           | t        | t         | ******** |          |
 scott    |    16384 | f           | f        | f         | ******** |          |
(2 rows)

2. 그룹관리


3. 데이터베이스 관리

3-1. 데이터베이스 생성

template1=# create database db_study;
CREATE DATABASE

4. 테이블 관리

4-1. 테이블 생성

C:\pgsql\bin>psql -U scott db_study
psql (8.4.0)
Type "help" for help.

db_study=> create table eng_word (
db_study(> inx integer,
db_study(> end_word varchar(100),
db_study(> primary key ( inx )
db_study(> );
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "eng_word_pkey" for table "eng_word"
CREATE TABLE


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 





 

댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
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
글 보관함