fv17の日記

Webエンジニアの備忘用ブログです。主にWeb界隈の技術に関して書いています。

postgresの起動と接続

PostgreSQL

起動

cd /usr/local/var
postgres -D ./postgres/

終了

Ctrl + c

psqlコマンド

データベース一覧

\l
or
psql -l

データベースへ接続

psql -d <database name>
psql -d postgres

データベースから切断

\q 
or 
exit

テーブル一覧

\dt

テーブル構造

\d <table name>
\d users