zhyiwww
          用平實(shí)的筆,記錄編程路上的點(diǎn)點(diǎn)滴滴………
          posts - 536,comments - 394,trackbacks - 0
          一般我們在安裝postgres后,如果想用psql在控制臺(tái)登錄的話,是需要一點(diǎn)配置的。主要有以下幾步:

          (1)安裝
          ?aptitude install postgresql-8.3

          (2)修改系統(tǒng)用戶postgres的密碼
          ?這個(gè)postgres是你的系統(tǒng)用戶。
          $ su (成功后)
          # passwd postgres

          (3)用postgres用戶登錄,修改數(shù)據(jù)庫用戶postgres的密碼
          在postgres用戶環(huán)境下,你已經(jīng)可以用psql登錄
          $ psql -h localhost -U postgres
          postgres # alter user postgres password 'postgres';

          (4)在其他用戶下,用psql登錄
          XXX $ psql -hlocalhost -U postgres
          就可以登錄了

          通過上面的配置,就可以在本機(jī)用所有的用戶登錄了。
          如果想通過其他的主機(jī)登錄postgres數(shù)據(jù)庫,還需要其他的配置。

          (5)打開監(jiān)聽,配置如下

          配置前
          root@zhangyi-desktop:/home/zhangyi# grep -i listen? /etc/postgresql/8.3/main/postgresql.conf

          # what IP address(es) to listen on;
          listen_addresses = 'localhost'?? ????
          # what IP address(es) to listen on;

          root@zhangyi-desktop:/home/zhangyi#

          配置后
          root@zhangyi-desktop:/home/zhangyi# grep -i listen? /etc/postgresql/8.3/main/postgresql.conf
          listen_addresses = '*'?? ????
          # what IP address(es) to listen on;
          #listen_addresses = 'localhost'?? ????
          # what IP address(es) to listen on;

          root@zhangyi-desktop:/home/zhangyi#

          (6)配置用戶授權(quán)
          vim /etc/postgresql/8.3/main/pg_hba.conf
          添加
          host??? all???????? all???????? 192.168.1.0/24????????? md5

          (7)重啟postgres

          # /etc/init.d/postgres restart




          ??







          |----------------------------------------------------------------------------------------|
                                     版權(quán)聲明  版權(quán)所有 @zhyiwww
                      引用請注明來源 http://www.aygfsteel.com/zhyiwww   
          |----------------------------------------------------------------------------------------|
          posted on 2009-06-26 15:41 zhyiwww 閱讀(532) 評(píng)論(0)  編輯  收藏 所屬分類: databaselinuxPostgres
          主站蜘蛛池模板: 民丰县| 永吉县| 游戏| 包头市| 石柱| 响水县| 托克托县| 永春县| 扶余县| 扬州市| 沿河| 贡嘎县| 陆丰市| 青岛市| 伽师县| 日照市| 浙江省| 和田县| 崇仁县| 永善县| 通州市| 廉江市| 肃南| 集贤县| 攀枝花市| 邢台市| 黄山市| 茶陵县| 富源县| 台湾省| 板桥市| 大同市| 五台县| 三河市| 呼图壁县| 浦江县| 屏东县| 峨边| 五华县| 祁东县| 马鞍山市|