一、建立数据库连接
----------------
接入PostgreSQL数据库: psql -h IP地址 -p 端口 -U 数据库名
之后会要求输入数据库密码
二、访问数据库
1、列举数据库:\l
2、选择数据库:\c 数据库名
3、查看该某个库中的所有表:\dt
4、切换数据库:\c interface
5、查看某个库中的某个表结构:\d 表名
6、查看某个...
分类:
数据库 时间:
2014-12-18 13:38:15
阅读次数:
507
前言:最近两三周积累一些常用的知识点,主要是平常工作中经常用的,共享一下。
postgre数据库导入导出
1.首先通过环境变量将postgre的bin路径配置到path下面
2.pg_dump -U postgres starxxxx > starxxxx.sql
3.psql -U postgres starxxxx
通过以上命令可以进行数据库包括序列的简单导入和...
分类:
其他好文 时间:
2014-12-04 10:19:39
阅读次数:
161
经常使用psql查询数据,现在总结几个常用的命令参数,供以后参考-h 数据库地址-U 数据库用户名-t 不打印字段等信息-c 执行的SQL语句-s 单步执行,就是执行的时候不断按回车事例:/opt/pg93/bin/psql -h ${TDATA_HOST} -U ${TDATA_USE...
分类:
数据库 时间:
2014-11-21 18:34:01
阅读次数:
173
[pg@h1 ~]$ vacuumdb --freeze template0
vacuumdb: could not connect to database template0: FATAL: database "template0" is not currently accepting connections
[pg@h1 ~]$ psql template0
psql: FATAL: da...
分类:
其他好文 时间:
2014-11-19 01:58:54
阅读次数:
234
删除数据库 sudo -u postgres dropdb $DB_NAME 导出数据库 pg_dump -h $DB_HOST -U $DB_USER --clean --schema=$DB_SCHEMA -d $DB_NAME > $DUMP_FILE_NAME 导入数据库 psql -U $...
分类:
数据库 时间:
2014-11-14 15:29:48
阅读次数:
245
安装前提:GUNmake版本:sudomake–versionGNUMake3.81#建议3.76.1或者更高版本需要一个ISO/ANSIC编译器(至少兼容C89)。GCC缺省时将自动使用GNUReadline库(这样可以方便地编辑和检索命令历史)。它允许psql(PostgreSQL命令行的SQL解释)记住每个命令类型,并允许您使用箭头?.
分类:
数据库 时间:
2014-11-13 19:05:47
阅读次数:
193
1. Open a command console and go to the directory where you installed Postgre server.
e.g. D:\Program Files\PostgreSQL\9.3\bin>
2. Drill down into BIN folder and issue following command.
psql -d -...
分类:
其他好文 时间:
2014-11-12 19:51:25
阅读次数:
215
磁盘空间不足的情况下,利用命名或者匿名管道迁移和导入数据;需要注意命名管道的权限问题。
0. Name PIP 0
[pg@h1 ~]$ psql gtlions -ac "select 't3' tab,count(*) from t3 union all select 't4',count(*) from t4;"
select 't3' tab,count(*) from t3 uni...
分类:
其他好文 时间:
2014-11-06 11:09:31
阅读次数:
206
putconfigurationinHUEasbelow:[librdbms]#TheRDBMSappcanhaveanynumberofdatabasesconfiguredinthedatabases#section.Adatabaseisknownbyitssectionname#(IEsqlite,mysql,psql,andoracleinthelistbelow).[[databases]]#sqliteconfiguration.##[[[sqlite]]]#NametoshowintheUI...
分类:
数据库 时间:
2014-10-31 15:55:19
阅读次数:
412
删除psql数据库:(以数据库Django名为例:)dropdbDjango;新建数据库并属于django:createdbDjango-Odjango当我们在Django中用了pythonmanage.pysyncdb后,会在PostgreSQL中新建了对应的应用的表,但是有时候会发现在admin管理平台时添加数据时出现CSRF错误。这时候,我们要采..
分类:
数据库 时间:
2014-10-31 06:29:20
阅读次数:
206