Chinaunix首页 | 论坛 | 博客
  • 博客访问: 352248
  • 博文数量: 86
  • 博客积分: 1460
  • 博客等级: 上尉
  • 技术积分: 848
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-12 14:07
文章分类

全部博文(86)

文章存档

2017年(36)

2016年(17)

2015年(1)

2013年(12)

2012年(2)

2011年(1)

2010年(1)

2009年(16)

我的朋友

分类: Mysql/postgreSQL

2016-06-11 18:32:41

linux 系统 
[ : ~ 18:02:58 ]$ cat /etc/issue
CentOS release 6.7 (Final)
Kernel \r on an \m

安装pg 9.4.8  yum 源   pgdg-redhat94-9.4-1.noarch.rpm
rpm -ivh pgdg-redhat94-9.4-1.noarch.rpm


安装pg
yum install postgresql94 postgresql94-server --disablerepo=* --enablerepo=pgdg94

修改service 带个9.4 看着烦
chkconfig --list
chkconfig --del postgresql-9.4
mv /etc/init.d/postgresql-9.4 /etc/init.d/postgres
chkconfig --add postgres

修改hba 配置  支持用户名 密码方式登录 否则
psql: FATAL:  Peer authentication failed for user "z"

psql: FATAL:  Peer authentication failed for user "zhouyf"

vi  /var/lib/pgsql/9.4/data/pg_hba.conf
This file controls:
  1. Which hosts are allowed to connect
  2. How clients are authenticated
  3. Which PostgreSQL user names they can use
  4. Which databases they can access
      

#添加两行 注释掉一行peer
# "local" is for Unix domain socket connections only
#local   all             all                                     peer
local   all             all                                     trust
host    all             all             127.0.0.1/32            trust

root启动pg server

service postgres start

连接
su - postgres
psql
\l  
\conninfo
create user zhouyf password '123';

\q

psql -Uzhouyf -W
\conninfo

发现不带W 也能进入  还是socket   后面研究了再更新
阅读(1204) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~