连接数据库

\c 数据库

查询表:

\dt

查询表结构:

\d tablename

 

查询数据库:

\l 

退出:

\q

 创建角色:

CREATE USER postgres SUPERUSER;
CREATE DATABASE postgres WITH OWNER postgres;

查询角色:

\du

 

查询数据库大小

select pg_size_pretty(pg_database_size('brew'));

根据模板建立数据库

 createdb -T template0 brew

将备份文件恢复至某数据库:

pg_restore -d brew /usr/local/brew.dmp

 删除数据库:

Drop database brew;

 

posted on 2016-04-11 14:48  小虾ff  阅读(111)  评论(0编辑  收藏  举报