---
title: "postgresql及phppgadmin的安装与配置"
url: "https://lerry.me/post/2013/05/postgresql-and-phppgadmin-config"
date: 2013-05-24T06:20:00.000Z
updated: 2026-08-26T23:15:15.697Z
tags:
  - "PostgreSQL"
  - "phpPgAdmin"
language: zh-CN
---

# postgresql及phppgadmin的安装与配置

最近在学校等着毕业，空余时间挺多的，就想捣鼓些没用过的新玩意，比如PostgreSQL。听说它功能丰富，性能、可靠性也不错。
我用的是 Debian 7，系统源的版本是9.1，而官方最新的是9.2，好在官方提供了一个源，可以安装最新版，具体配置方法见官网，此处不再赘述。
安装也简单，apt-get install 就可以。关键是配置，
网上资料很多，这个算是挺靠谱的，
- [Ubuntu PostgreSQL Server Guide](https://help.ubuntu.com/10.04/serverguide/postgresql.html)
- [Ubuntu 中文 wiki: PostgreSQL](http://wiki.ubuntu.org.cn/PostgreSQL)

```bash
sudo -u postgres psql template1

ALTER USER postgres with encrypted password 'your_password'; 
# your_password 为你要设置的密码

#也可以这样重置密码
sudo passwd postgres

# 然后修改 /etc/postgresql/9.2/main/pg_hba.conf，加上这一行
# 提示: provided username (postgres) and authenticated user name (www-data) do not match
local   all         postgres                          md5
# 管理工具我用的是 phpPgAdmin，需要将 conf/config.inc.php 中的 extra_login_security 设置为 false
$conf['extra_login_security'] = false
# 这样就可以用 postgres 这个账户和你设置的密码登录了

```
