分享
 
 
 

第十章LinuxPostgreSQLDatabase服务器(二)

王朝system·作者佚名  2008-05-18
窄屏简体版  字體: |||超大  

命令

安装到系统中的文件

命令

下面列出的是一些我们经常要用到的命令,当然还有很多其它的命令,更详细的信息可以查看man帮助页或其它文档。

在"pg_hba.conf"文件的PG_DATA段可以用ip地址和用户名限制对能数据库的连接。

l 用“createuser”命令在数据库中定义一个新用户:

[root@deep]# su postgres

[postgres@deep]$ createuser

Enter name of user to add ---> admin

Enter user's postgres ID or RETURN to use unix user ID: 500 ->

Is user "admin" allowed to create databases (y/n) y

Is user "admin" a superuser? (y/n) y

createuser: admin was successfully added

l 用“destroyuser”命令在数据库中删除用户:

[root@deep]# su postgres

[postgres@deep]$ destroyuser

Enter name of user to delete ---> admin

destroyuser: delete of user admin was successful.

l 用“createdb”命令创建新的数据库:

[root@deep]# su postgres

[postgres@deep]$ createdb dbname (the name of the database).

也可以用postgres的终端程序(psql)完成:

[root@deep]# su admin

[admin@deep]$ psql template1

Welcome to the POSTGRESQL interactive sql monitor:

Please read the file COPYRIGHT for copyright terms of POSTGRESQL

[PostgreSQL 6.5.3 on i686-pc-linux-gnu, compiled by egcs ]

type ? for help on slash commands

type q to quit

type g or terminate with semicolon to execute query

You are currently connected to the database: template1

template1 è create database foo;

CREATEDB

其它一些有用的终端程序(psql)命令:

l 连接到另外的数据库:

template1 è c foo

connecting to new database: foo

foo è

l 创建一个表:

foo è create table bar (i int4, c char(16));

CREATE

foo è

l 检查新表:

foo è d bar

Table = bar

+-------+--------+--------+

| Field | Type | Length |

+-------+--------+--------+

| I | int4 | 4 |

| c | char() | 16 |

+-------+--------+--------+

foo è

l 删除表、索引、视图:

foo è drop table table_name;

foo è drop index index_name;

foo è drop view view_name;

l 往一个表里插入记录:

foo è insert into table_name (name_of_attr1, name_of_attr2, name_of_attr3)

foo è values (value1, value2, value3);

安装到系统中的文件

> /etc/rc.d/init.d/postgresql

> /etc/rc.d/rc0.d/K15postgresql

> /etc/rc.d/rc1.d/K15postgresql

> /etc/rc.d/rc2.d/K15postgresql

> /etc/rc.d/rc3.d/S85postgresql

> /etc/rc.d/rc4.d/S85postgresql

> /etc/rc.d/rc5.d/S85postgresql

> /etc/rc.d/rc6.d/K15postgresql

> /usr/bin/postgres

> /usr/bin/postmaster

> /usr/bin/ecpg

> /usr/bin/pg_id

> /usr/bin/pg_version

> /usr/bin/psql

> /usr/bin/pg_dump

> /usr/bin/pg_dumpall

> /usr/bin/pg_upgrade

> /usr/bin/pg_passwd

> /usr/bin/cleardbdir

> /usr/bin/createdb

> /usr/bin/createlang

> /usr/bin/createuser

> /usr/bin/destroydb

> /usr/bin/destroylang

> /usr/bin/destroyuser

> /usr/bin/initdb

> /usr/bin/vacuumdb

> /usr/bin/initlocation

> /usr/bin/ipcclean

> /usr/include/lib

> /usr/include/lib/dllist.h

> /usr/include/pgsql

> /usr/include/pgsql/access

> /usr/include/pgsql/access/attnum.h

> /usr/include/pgsql/commands

> /usr/include/pgsql/commands/trigger.h

> /usr/include/pgsql/executor

> /usr/include/pgsql/executor/spi.h

> /usr/include/pgsql/libpq

> /usr/include/pgsql/libpq/pqcomm.h

> /usr/include/pgsql/libpq/libpq-fs.h

> /usr/include/pgsql/libpq++

> /usr/include/pgsql/libpq++/pgconnection.h

> /usr/include/pgsql/libpq++/pgdatabase.h

> /usr/man/manl/begin.l

> /usr/man/manl/close.l

> /usr/man/manl/cluster.l

> /usr/man/manl/commit.l

> /usr/man/manl/copy.l

> /usr/man/manl/create_aggregate.l

> /usr/man/manl/create_database.l

> /usr/man/manl/create_function.l

> /usr/man/manl/create_index.l

> /usr/man/manl/create_language.l

> /usr/man/manl/create_operator.l

> /usr/man/manl/create_rule.l

> /usr/man/manl/create_sequence.l

> /usr/man/manl/create_table.l

> /usr/man/manl/create_trigger.l

> /usr/man/manl/create_type.l

> /usr/man/manl/create_user.l

> /usr/man/manl/create_version.l

> /usr/man/manl/create_view.l

> /usr/man/manl/declare.l

> /usr/man/manl/delete.l

> /usr/man/manl/drop.l

> /usr/man/manl/drop_aggregate.l

> /usr/man/manl/drop_database.l

> /usr/man/manl/drop_function.l

> /usr/man/manl/drop_index.l

> /usr/man/manl/drop_language.l

> /usr/man/manl/drop_operator.l

> /usr/man/manl/drop_rule.l

> /usr/man/manl/drop_sequence.l

> /usr/man/manl/drop_table.l

> /usr/man/manl/drop_trigger.l

> /usr/man/manl/drop_type.l

> /usr/man/manl/drop_user.l

> /usr/man/manl/drop_view.l

> /usr/man/manl/end.l

> /usr/man/manl/explain.l

> /usr/man/manl/fetch.l

> /usr/man/manl/grant.l

> /usr/man/manl/insert.l

> /usr/man/manl/listen.l

> /usr/man/manl/load.l

> /usr/man/manl/lock.l

> /usr/man/manl/move.l

> /usr/include/pgsql/libpq++/pgtransdb.h

> /usr/include/pgsql/libpq++/pgcursordb.h

> /usr/include/pgsql/libpq++/pglobject.h

> /usr/include/pgsql/port

> /usr/include/pgsql/port/linux

> /usr/include/pgsql/utils

> /usr/include/pgsql/utils/geo_decls.h

> /usr/include/pgsql/utils/elog.h

> /usr/include/pgsql/utils/palloc.h

> /usr/include/pgsql/utils/mcxt.h

> /usr/include/pgsql/fmgr.h

> /usr/include/pgsql/os.h

> /usr/include/pgsql/config.h

> /usr/include/pgsql/c.h

> /usr/include/pgsql/postgres.h

> /usr/include/pgsql/postgres_ext.h

> /usr/include/pgsql/libpq-fe.h

> /usr/include/pgsql/libpq-int.h

> /usr/include/pgsql/ecpgerrno.h

> /usr/include/pgsql/ecpglib.h

> /usr/include/pgsql/ecpgtype.h

> /usr/include/pgsql/sqlca.h

> /usr/include/pgsql/libpq++.H

> /usr/lib/libpq.a

> /usr/lib/libpq.so.2.0

> /usr/lib/libpq.so.2

> /usr/lib/libpq.so

> /usr/lib/libecpg.a

> /usr/lib/libecpg.so.3.0.0

> /usr/lib/libecpg.so.3

> /usr/lib/libecpg.so

> /usr/lib/libpq++.a

> /usr/lib/libpq++.so.3.0

> /usr/lib/libpq++.so.3

> /usr/lib/libpq++.so

> /usr/lib/plpgsql.so

> /usr/lib/pgsql

> /usr/lib/pgsql/global1.bki.source

> /usr/lib/pgsql/local1_template1.bki.source

> /usr/lib/pgsql/pg_geqo.sample

> /usr/lib/pgsql/pg_hba.conf.sample

> /usr/man/man1/cleardbdir.1

> /usr/man/man1/createdb.1

> /usr/man/man1/createuser.1

> /usr/man/man1/destroydb.1

> /usr/man/man1/destroyuser.1

> /usr/man/man1/ecpg.1

> /usr/man/man1/initdb.1

> /usr/man/man1/initlocation.1

> /usr/man/man1/ipcclean.1

> /usr/man/man1/pg_dump.1

> /usr/man/man1/pg_dumpall.1

> /usr/man/man1/pg_passwd.1

> /usr/man/man1/pg_upgrade.1

> /usr/man/man1/postgres.1

> /usr/man/man1/postmaster.1

> /usr/man/man1/psql.1

> /usr/man/man3/catalogs.3

> /usr/man/man3/libpq.3

> /usr/man/man5/pg_hba.conf.5

> /usr/man/manl

> /usr/man/manl/abort.l

> /usr/man/manl/alter_table.l

> /usr/man/manl/alter_user.l

> /usr/man/manl/notify.l

> /usr/man/manl/reset.l

> /usr/man/manl/revoke.l

> /usr/man/manl/rollback.l

> /usr/man/manl/select.l

> /usr/man/manl/set.l

> /usr/man/manl/show.l

> /usr/man/manl/sql.l

> /usr/man/manl/update.l

> /usr/man/manl/vacuum.l

> /var/lib/pgsql

> /var/lib/pgsql/base

> /var/lib/pgsql/base/template1

> /var/lib/pgsql/base/template1/pg_proc

> /var/lib/pgsql/base/template1/pg_type

> /var/lib/pgsql/base/template1/pg_attribute

> /var/lib/pgsql/base/template1/pg_class

> /var/lib/pgsql/base/template1/pg_inherits

> /var/lib/pgsql/base/template1/pg_index

> /var/lib/pgsql/base/template1/pg_statistic

> /var/lib/pgsql/base/template1/pg_operator

> /var/lib/pgsql/base/template1/pg_opclass

> /var/lib/pgsql/base/template1/pg_am

> /var/lib/pgsql/base/template1/pg_amop

> /var/lib/pgsql/base/template1/pg_amproc

> /var/lib/pgsql/base/template1/pg_language

> /var/lib/pgsql/base/template1/pg_aggregate

> /var/lib/pgsql/base/template1/pg_ipl

> /var/lib/pgsql/base/template1/pg_inheritproc

> /var/lib/pgsql/base/template1/pg_rewrite

> /var/lib/pgsql/base/template1/pg_listener

> /var/lib/pgsql/base/template1/pg_description

> /var/lib/pgsql/base/template1/pg_attribute_relid_attnam_index

> /var/lib/pgsql/base/template1/pg_attribute_relid_attnum_index

> /var/lib/pgsql/base/template1/pg_attribute_attrelid_index

> /var/lib/pgsql/base/template1/pg_proc_oid_index

> /var/lib/pgsql/base/template1/pg_proc_proname_narg_type_index

> /var/lib/pgsql/base/template1/pg_proc_prosrc_index

> /var/lib/pgsql/base/template1/pg_type_oid_index

> /var/lib/pgsql/base/template1/pg_type_typname_index

> /var/lib/pgsql/base/template1/pg_class_oid_index

> /var/lib/pgsql/base/template1/pg_class_relname_index

> /var/lib/pgsql/base/template1/pg_attrdef

> /var/lib/pgsql/base/template1/pg_attrdef_adrelid_index

> /var/lib/pgsql/base/template1/pg_relcheck

> /var/lib/pgsql/base/template1/pg_relcheck_rcrelid_index

> /var/lib/pgsql/base/template1/pg_trigger

> /var/lib/pgsql/base/template1/pg_trigger_tgrelid_index

> /var/lib/pgsql/base/template1/pg_description_objoid_index

> /var/lib/pgsql/base/template1/PG_VERSION

> /var/lib/pgsql/base/template1/pg_user

> /var/lib/pgsql/base/template1/pg_rules

> /var/lib/pgsql/base/template1/pg_views

> /var/lib/pgsql/base/template1/pg_tables

> /var/lib/pgsql/base/template1/pg_indexes

> /var/lib/pgsql/pg_variable

> /var/lib/pgsql/pg_database

> /var/lib/pgsql/pg_shadow

> /var/lib/pgsql/pg_group

> /var/lib/pgsql/pg_log

> /var/lib/pgsql/PG_VERSION

> /var/lib/pgsql/pg_hba.conf

> /var/lib/pgsql/pg_geqo.sample

> /var/lib/pgsql/pg_pwd'

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有