postgresql
- まずpostgresqlになってみる
amori@popowa:~$ sudo su postgres
- DBを作ってみる
postgres@popowa:/home/amori$ createdb test_db_1
CREATE DATABASE
#出来た
- 次はユーザを追加してみる
postgres@popowa:/home/amori$ createuser test_db_user
Shall the new user be allowed to create databases? (y/n) n
Shall the new user be allowed to create more new users? (y/n) n
CREATE USER
#出来た
- DBを立ち上げてみる
postgres@popowa:/home/amori$ psql test_db_1
Welcome to psql 7.4.7, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
test_db_1=#
- tableを作ってみる
test=# create table weather(
test(# city varchar(80),
test(# temp_lo int,
test(# temp_hi int,
test(# prcp real,
test(# date date
test(# );
CREATE TABLE
- DB削除する
dropdb {db name}
- version
test=# select version();
version
PostgreSQL 7.4.7 on i386-pc-linux-gnu, compiled by GCC i386-linux-gcc (GCC) 3.3.5 (Debian 1:3.3.5-12)
(1 row)
|