PostgreSQL中的基本命令总结

来源:互联网 发布:北京航空运输十年数据 编辑:程序博客网 时间:2024/05/17 22:22

最近几天由于工作需要,用到PostgreSQL,安装的是64 位的PostgreSQL 9.6版本,现将基本的命令行指令总结一下,以备忘。

特别说明:Command line execute files are in the folder <PostgreSQL install dir>\bin

1、创建数据库:

   (1)菜单是最简单的方法:

    

(2)指令创建:createdb -U postgres test

2、Restore 数据库:pg_restore -d test -U postgres c:\\test.backup

3、删除数据库:dropdb -U postgres test

   Sometimes the database couldn't be dropped because other sessions are using it. In this scenario, run the command in SQL Shell(psql) to close all the sessions:

   

4、备份数据库:pg_dump -f c:\\test.backup -U postgres -W -F c test

以上四部分是最常用的数据库操作指令,数据库建好之后,接下来就是在Server中配置数据库,由于时间关系,该部分现在不作说明,后面如果时间允许,再更新博文将此部分加进去。

PostgreSQL安装包下载:https://pan.baidu.com/s/1bFXlAQ




原创粉丝点击