標籤:os 使用 for ar 資料 2014 art cti on
在fedora 20中在我2014-8-27日安裝pg時,pg版本是9.3.5.1我不知是會由pg開發組自動更新還是別的,但安裝後一般是最新的版本了。
安裝:
yum install postgresql yum install postgresql-server yum install pgadmin3 yum install postgresql-contrib yum update postgresql-setup initdb systemctl enable postgresql.service
直接使用pgadmin3, 然後就發現了下面的錯誤: Error connecting to the server: 致命錯誤: 使用者 “postgres” Ident 認證失敗 切換到postgres使用者,#su - postgres $psql進入到postgres的控制shell, \passwd, 指定新的密碼 修改 pg_hba.conf 將它的認證方式由 ident改成md5 再pg_ctrl restart, 重啟, 好用了。
但我在修改了使用者的密碼,不能登入,於是乎做了以下的操作
密碼登入:
1、編輯pg_hba.conf,將md5認證修改成trust認證,編輯後退出儲存
[postgres @ pgsqldb-master bin]$ vi ../data/pg_hba.conf
2、執行pg_ctl reload載入生效
[postgres @ pgsqldb-master bin]$ pg_ctl reload
server signaled
3、psql串連,用alter role修改密碼
[postgres @ pgsqldb-master bin]$ psql
psql (9.2.3)
Type “help” for help.
postgres=# alter role postgres with password ‘123‘;
ALTER ROLE
postgres=#
4、退出psql
5、編輯pg_hba.conf,將turst認證修改成md5認證,編輯後退出儲存
6、執行pg_ctl reload載入生效
fedora 20中安裝postgresql資料庫