linux未知用户 postgres,Linux下postgresql忘记密码,以其他用户登录,phpmyadmin默认不允许登录的问题解决...

Postgres允许以linux其他用户在命令行登录的配置:

1.修改/usr/local/pgsql/data目录下的文件pg_hba.conf

local   all         all                               ident omicron

2.修改/usr/local/pgsql/data目录下的文件pg_ident.conf 添加

omicron             root             postgres

3. 重启postgres

执行 /etc/init.d/postgresql restart

4.访问数据库时使用以下命令:

/usr/local/pgsql/bin/psql mydb -U postgres

这里用的是psql的绝对路径,如果是用过系统自动安装的情况,直接psql也是可以的,这个就根据你的系统情况而定了。1,2步骤里的路径也是如此。

Postgres默认不允许phppgadmin登录的问题:

1.修改/var/lib/pgsql/data/pg_hba.conf文件,如下:

#IPV4 local connections

host all all 127.0.0.1/32 md5  改为md5认证

2.修改/var/www/html/phppgadmin/conf/config.inc.php

$conf['extra_login_security'] = false; 改为false

3.执行以下命令,创建postgre用户

#su postgres

$createuser test

输入两次密码....

问你是否将此用户设置为serperuser?选择yes

用户创建成功.

$exit   切换回root用户

#/etc/rc.d/init.d/postgresql restart 重启postgre数据库

再次用test用户和密码登陆phppgadmin即可。

修改数据库服务器密码:

以postgres用户执行psql postgres

执行: ALTER USER postgres WITH ENCRYPTED PASSWORD 'yourpassword'

效果:

-----------------------------------------------------------------------------------------------------------------

Welcome to psql 8.2.6, 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=# ALTER USER postgres WITH ENCRYPTED PASSWORD 'yourpassword';

ALTER ROLE

postgres=#

------------------------------------------------------------------------------------------------------------------

以上内容分别来自于以下地址:

http://hi.baidu.com/luna_kiss_moon/blog/item/f57ba70ec71c8eeb37d12226.html

http://www.xxlinux.com/linux/article/development/database/20070919/9818.html

http://www.hacms.com/html/2010/0308/34551.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值