LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1450|回复: 4

postgresql的问题(arch的gnome下)

[复制链接]
发表于 2006-11-20 02:04:04 | 显示全部楼层 |阅读模式
用pacman -S postgresql php perl装了三个以后.好像POSTGRESQL的路径太乱了.系统装的.我没有手工指定.

用root改过这里
[root@archlinux ~]# cat .bashrc
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '

test -n "$DISPLAY" && export TERM=xterm-color
[color="Red"]PGLIB=/usr/lib/postgresql
PGDATA=/var/lib/postgres/data
PATH=$PATH:/etc/rc.d/
export PGLIB PGDATA PATH
[root@archlinux ~]#



[color="#ff0000"]用initba初始化时出现
bash-3.1$ initdb
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locales
  COLLATE:  C
  CTYPE:    zh_CN.utf8
  MESSAGES: zh_CN.utf8
  MONETARY: zh_CN.utf8
  NUMERIC:  zh_CN.utf8
  TIME:     zh_CN.utf8
The default database encoding has accordingly been set to UTF8.

initdb: directory "/var/lib/postgres/data" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/postgres/data" or run initdb
with an argument other than "/var/lib/postgres/data".
bash-3.1$ rm -r /var/lib/postgres/data
bash-3.1$ initdb
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locales
  COLLATE:  C
  CTYPE:    zh_CN.utf8
  MESSAGES: zh_CN.utf8
  MONETARY: zh_CN.utf8
  NUMERIC:  zh_CN.utf8
  TIME:     zh_CN.utf8
The default database encoding has accordingly been set to UTF8.

creating directory /var/lib/postgres/data ... ok
creating directory /var/lib/postgres/data/global ... ok
creating directory /var/lib/postgres/data/pg_xlog ... ok
creating directory /var/lib/postgres/data/pg_xlog/archive_status ... ok
creating directory /var/lib/postgres/data/pg_clog ... ok
creating directory /var/lib/postgres/data/pg_subtrans ... ok
creating directory /var/lib/postgres/data/pg_twophase ... ok
creating directory /var/lib/postgres/data/pg_multixact/members ... ok
creating directory /var/lib/postgres/data/pg_multixact/offsets ... ok
creating directory /var/lib/postgres/data/base ... ok
creating directory /var/lib/postgres/data/base/1 ... ok
creating directory /var/lib/postgres/data/pg_tblspc ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 1000
creating configuration files ... ok
creating template1 database in /var/lib/postgres/data/base/1 ... ok
initializing pg_authid ... ok
enabling unlimited row size for system tables ... ok
initializing dependencies ... ok
creating system views ... ok
loading pg_description ... ok
creating conversions ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

    postmaster -D /var/lib/postgres/data
or
    pg_ctl -D /var/lib/postgres/data -l logfile start

bash-3.1$ postmaster -D /var/lib/postgres/data
LOG:  database system was shut down at 2006-11-20 01:12:14 UTC
LOG:  checkpoint record is at 0/33A6AC
LOG:  redo record is at 0/33A6AC; undo record is at 0/0; shutdown TRUE
LOG:  next transaction ID: 565; next OID: 10794
LOG:  next MultiXactId: 1; next MultiXactOffset: 0
LOG:  database system is ready
LOG:  transaction ID wrap limit is 2147484146, limited by database "postgres"
[color="#ff0000"]FATAL:  database "root" does not exist




就停在这了

我另开一窗口运行想试增加用户
bash-3.1$ useradd linuxqq
Password:           #输入ulj(没用过的)
useradd:PAM 验证失败

bash-3.1$ psql
Welcome to psql 8.1.5, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

[color="#ff0000"]postgres=#
请问这样算正常了吗?(第一次学数据库,别见笑)

[color="#ff0000"]#ps -auxf
postgres  3227  0.0  0.2   5228  1648 pts/0    S    00:54   0:00  |       \_ bash
postgres  4375  0.0  0.4  19480  3164 pts/0    S+   01:21   0:00  |           \_ postmaster -D /var/lib/postgre
postgres  4378  0.0  0.1  19480  1060 pts/0    S+   01:21   0:00  |               \_ postgres: writer process  
postgres  4379  0.0  0.1  10260   928 pts/0    S+   01:21   0:00  |               \_ postgres: stats buffer pro
postgres  4380  0.0  0.1   9488  1140 pts/0    S+   01:21   0:00  |               |   \_ postgres: stats collec
postgres  4887  0.0  0.3  19892  2052 pts/0    S+   01:34   0:00  |               \_ postgres: postgres postgre
root      2099  0.0  0.2   4968  1692 pts/1    Ss   00:24   0:00  \_ bash
root      2440  0.0  0.1   4248   844 pts/1    S    00:33   0:00  |   \_ su postgres
postgres  2441  0.0  0.2   5224  1624 pts/1    S    00:33   0:00  |       \_ bash
root      2576  0.0  0.1   4252   860 pts/1    S    00:37   0:00  |           \_ su root
root      2578  0.0  0.2   5136  1840 pts/1    S    00:37   0:00  |               \_ bash
root      4811  0.0  0.1   4252   848 pts/1    S    01:32   0:00  |                   \_ su postgres
postgres  4812  0.0  0.2   5228  1628 pts/1    S    01:32   0:00  |                       \_ bash
postgres  4886  0.0  0.2   6808  1884 pts/1    S+   01:34   0:00  |

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
发表于 2006-11-25 16:00:27 | 显示全部楼层
Post by uljling

我另开一窗口运行想试增加用户
bash-3.1$ useradd linuxqq
Password: #输入ulj(没用过的)
useradd:PAM 验证失败


你su - postgres,切换到操作系统的postgres用户吧。然后再执行这个操作。关于pg的授权验证,你可以查看资料

pg_hba.conf 文件
http://www.google.com/search?hl= ... 9C%E7%B4%A2&lr=
回复 支持 反对

使用道具 举报

发表于 2006-11-25 16:16:59 | 显示全部楼层
Post by uljling


bash-3.1$ psql
Welcome to psql 8.1.5, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit



是的。你进入pg了。

geisha:~ # su - postgres
postgres@geisha:~> psql
Welcome to psql 8.1.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

postgres=# \?
postgres=# \l
         数据库列表
   名字    |  所有者  | 编码
-----------+----------+------
postgres  | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(3 行)

postgres=#

切换到到postgres用户,然后才进入,是简化认证的麻烦。然后运行psql客户端,\?得到帮助信息。\l列出所有数据库。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-12-3 03:25:57 | 显示全部楼层
谢谢,已经用postgres管理员方式用得了.
回复 支持 反对

使用道具 举报

发表于 2006-12-3 18:13:24 | 显示全部楼层
enjoy it
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表