免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3334 | 回复: 1
打印 上一主题 下一主题

Debian 安装 Postgresql 出现错误,懂的帮着看看 [复制链接]

论坛徽章:
1
操作系统版块每日发帖之星
日期:2016-07-06 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-04-18 10:56 |只看该作者 |倒序浏览
执行:

postgres -D /database/postgresql/data

出现错误:

HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.

WARNING: could not create listen socket for "localhost"

FATAL: could not create any TCP/IP sockets

论坛徽章:
0
2 [报告]
发表于 2008-04-18 11:15 |只看该作者
PostgreSQL
Install

安装环境 ubuntu 7.10
$ sudo apt-get install postgresql-8.2

netkiller@shenzhen:~$ sudo apt-get install postgresql-8.2
               

Postgres 配置

8.1.5之后版本不在使用tcpip_socket,改用listen_addresses

去掉注释

listen_addresses = 'localhost'
               

如果有多个网络适配器可以指定 'ip' 或 '*'

postgres@Linux-server:~$ vi /etc/postgresql/8.2/main/postgresql.conf

listen_addresses = '*'

postgres@Linux-server:~$
               

访问权限

netkiller@Linux-server:~$ sudo vi /etc/postgresql/8.1/main/pg_hba.conf
host    woodart                woodart      0.0.0.0/0       md5
hostssl woodart     all                     0.0.0.0/0       md5

               

设置Postgres管理员密码

netkiller@Linux-server:~$ sudo passwd postgres
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
               

su postgres

netkiller@Linux-server:~$ su - postgres
Password:
postgres@Linux-server:~$ pwd
/var/lib/postgresql
postgres@Linux-server:~$
               

psql环境

postgres@Linux-server:~$ psql
Welcome to psql 8.1.4, 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=#
               

退出\q

postgres=# \q
               

创建数据,用户

CREATE ROLE woodart LOGIN
  ENCRYPTED PASSWORD 'md58360b47e149f615d2d52f98d1b22431a'
  NOSUPERUSER NOINHERIT CREATEDB NOCREATEROLE;

CREATE DATABASE woodart
  WITH OWNER = woodart
       ENCODING = 'UTF8'
       TABLESPACE = pg_default;
               

使用psql登录

postgres@Linux-server:~$ psql -h127.0.0.1 -dwoodart -Uwoodart
Password for user woodart:
Welcome to psql 8.1.4, 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

SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)

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

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP