본문 바로가기
데이터베이스/Postgresql

사용자 생성

by cbwstar 2021. 5. 10.
728x90
반응형

C:\Users\cbw>docker exec -it postgres /bin/bash

root@3d939a692d63:/# ls

bin  boot  dev  docker-entrypoint-initdb.d  docker-entrypoint.sh  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

root@3d939a692d63:/# pwd

/

root@3d939a692d63:/# psql -U postgres

psql (13.2 (Debian 13.2-1.pgdg100+1))

Type "help" for help.

 

postgres=# create user cbw password 'cbw' superuser;

CREATE ROLE

 

postgres=# create database cbw owner cbw;

CREATE DATABASE

 

postgres=# \c cbw cbw

You are now connected to database "cbw" as user "cbw".

 

 

CREATE TABLE star (

 id integer NOT NULL,

name character varying(255),

class character varying(32),

age integer,

radius integer,

lum integer,

 magnt integer,

 CONSTRAINT star_pk PRIMARY KEY (id)

);

CREATE TABLE

 

cbw=# \dt

       List of relations

 Schema | Name | Type  | Owner

--------+------+-------+-------

 public | star | table | cbw

(1 row)

 

cbw=# select * from star;

 id | name | class | age | radius | lum | magnt

----+------+-------+-----+--------+-----+-------

(0 rows)

 

cbw=#

728x90
반응형

댓글



"이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다."

loading