Can't to log in postgres account by pgAdmin












0















Before I changed my forgotten postgres pass using 'su - root' in command line.
Then I try to connect server using pgAdmin and I get error:



Error connecting to the server: FATAL:  password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"


But in command line I successfully log in postgres account:



su - postgres









share|improve this question





























    0















    Before I changed my forgotten postgres pass using 'su - root' in command line.
    Then I try to connect server using pgAdmin and I get error:



    Error connecting to the server: FATAL:  password authentication failed for user "postgres"
    FATAL: password authentication failed for user "postgres"


    But in command line I successfully log in postgres account:



    su - postgres









    share|improve this question



























      0












      0








      0








      Before I changed my forgotten postgres pass using 'su - root' in command line.
      Then I try to connect server using pgAdmin and I get error:



      Error connecting to the server: FATAL:  password authentication failed for user "postgres"
      FATAL: password authentication failed for user "postgres"


      But in command line I successfully log in postgres account:



      su - postgres









      share|improve this question
















      Before I changed my forgotten postgres pass using 'su - root' in command line.
      Then I try to connect server using pgAdmin and I get error:



      Error connecting to the server: FATAL:  password authentication failed for user "postgres"
      FATAL: password authentication failed for user "postgres"


      But in command line I successfully log in postgres account:



      su - postgres






      postgresql






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 10 '15 at 10:53









      hg8

      9,719125389




      9,719125389










      asked Nov 10 '15 at 10:05









      AlexAlex

      111




      111






















          1 Answer
          1






          active

          oldest

          votes


















          0














          There's a postgres unix user account password, which you can change using passwd as root.



          There is also a totally unrelated postgres role in the database, which might have a password of its own. This is totally unaffected by the passwd command. If you have forgotten this password, you have to reset it within PostgreSQL. See:




          • https://stackoverflow.com/q/10845998/398670

          • https://dba.stackexchange.com/q/19643/7788


          etc.



          The reason it works from psql but not PgAdmin is probably that you'll be using a unix socket with psql, using peer authentication to bypass password auth completely. If you've got localhost in your connection setup for PgAdmin it'll use TCP/IP instead, which is probably set to require md5 password authentication. Check your pg_hba.conf to confirm.






          share|improve this answer


























          • I've changed pg_hba.conf. I put 'trust' in place of 'peer'/'md5' of localhost.

            – Alex
            Nov 11 '15 at 10:21













          • @Alex If you did so for both host and local lines, and reloaded/restarted PostgreSQL, you should be able to log in fine. Though of course so can anyone else with access to your machine.

            – Craig Ringer
            Nov 11 '15 at 10:24











          • Yes, I restarted Postgres Server. It's a part of pg_hba.conf Allow replication connections from localhost, by a user with the # replication privilege. #local replication postgres trust #host replication postgres 127.0.0.1/32 trust #host replication postgres ::1/128 trust

            – Alex
            Nov 11 '15 at 10:36













          • Ouch. I did it :) It seems I didn't close pg_hba.conf and tried to connect server)

            – Alex
            Nov 11 '15 at 10:43













          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f696187%2fcant-to-log-in-postgres-account-by-pgadmin%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          There's a postgres unix user account password, which you can change using passwd as root.



          There is also a totally unrelated postgres role in the database, which might have a password of its own. This is totally unaffected by the passwd command. If you have forgotten this password, you have to reset it within PostgreSQL. See:




          • https://stackoverflow.com/q/10845998/398670

          • https://dba.stackexchange.com/q/19643/7788


          etc.



          The reason it works from psql but not PgAdmin is probably that you'll be using a unix socket with psql, using peer authentication to bypass password auth completely. If you've got localhost in your connection setup for PgAdmin it'll use TCP/IP instead, which is probably set to require md5 password authentication. Check your pg_hba.conf to confirm.






          share|improve this answer


























          • I've changed pg_hba.conf. I put 'trust' in place of 'peer'/'md5' of localhost.

            – Alex
            Nov 11 '15 at 10:21













          • @Alex If you did so for both host and local lines, and reloaded/restarted PostgreSQL, you should be able to log in fine. Though of course so can anyone else with access to your machine.

            – Craig Ringer
            Nov 11 '15 at 10:24











          • Yes, I restarted Postgres Server. It's a part of pg_hba.conf Allow replication connections from localhost, by a user with the # replication privilege. #local replication postgres trust #host replication postgres 127.0.0.1/32 trust #host replication postgres ::1/128 trust

            – Alex
            Nov 11 '15 at 10:36













          • Ouch. I did it :) It seems I didn't close pg_hba.conf and tried to connect server)

            – Alex
            Nov 11 '15 at 10:43


















          0














          There's a postgres unix user account password, which you can change using passwd as root.



          There is also a totally unrelated postgres role in the database, which might have a password of its own. This is totally unaffected by the passwd command. If you have forgotten this password, you have to reset it within PostgreSQL. See:




          • https://stackoverflow.com/q/10845998/398670

          • https://dba.stackexchange.com/q/19643/7788


          etc.



          The reason it works from psql but not PgAdmin is probably that you'll be using a unix socket with psql, using peer authentication to bypass password auth completely. If you've got localhost in your connection setup for PgAdmin it'll use TCP/IP instead, which is probably set to require md5 password authentication. Check your pg_hba.conf to confirm.






          share|improve this answer


























          • I've changed pg_hba.conf. I put 'trust' in place of 'peer'/'md5' of localhost.

            – Alex
            Nov 11 '15 at 10:21













          • @Alex If you did so for both host and local lines, and reloaded/restarted PostgreSQL, you should be able to log in fine. Though of course so can anyone else with access to your machine.

            – Craig Ringer
            Nov 11 '15 at 10:24











          • Yes, I restarted Postgres Server. It's a part of pg_hba.conf Allow replication connections from localhost, by a user with the # replication privilege. #local replication postgres trust #host replication postgres 127.0.0.1/32 trust #host replication postgres ::1/128 trust

            – Alex
            Nov 11 '15 at 10:36













          • Ouch. I did it :) It seems I didn't close pg_hba.conf and tried to connect server)

            – Alex
            Nov 11 '15 at 10:43
















          0












          0








          0







          There's a postgres unix user account password, which you can change using passwd as root.



          There is also a totally unrelated postgres role in the database, which might have a password of its own. This is totally unaffected by the passwd command. If you have forgotten this password, you have to reset it within PostgreSQL. See:




          • https://stackoverflow.com/q/10845998/398670

          • https://dba.stackexchange.com/q/19643/7788


          etc.



          The reason it works from psql but not PgAdmin is probably that you'll be using a unix socket with psql, using peer authentication to bypass password auth completely. If you've got localhost in your connection setup for PgAdmin it'll use TCP/IP instead, which is probably set to require md5 password authentication. Check your pg_hba.conf to confirm.






          share|improve this answer















          There's a postgres unix user account password, which you can change using passwd as root.



          There is also a totally unrelated postgres role in the database, which might have a password of its own. This is totally unaffected by the passwd command. If you have forgotten this password, you have to reset it within PostgreSQL. See:




          • https://stackoverflow.com/q/10845998/398670

          • https://dba.stackexchange.com/q/19643/7788


          etc.



          The reason it works from psql but not PgAdmin is probably that you'll be using a unix socket with psql, using peer authentication to bypass password auth completely. If you've got localhost in your connection setup for PgAdmin it'll use TCP/IP instead, which is probably set to require md5 password authentication. Check your pg_hba.conf to confirm.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 23 '17 at 12:39









          Community

          1




          1










          answered Nov 10 '15 at 10:13









          Craig RingerCraig Ringer

          2,91411615




          2,91411615













          • I've changed pg_hba.conf. I put 'trust' in place of 'peer'/'md5' of localhost.

            – Alex
            Nov 11 '15 at 10:21













          • @Alex If you did so for both host and local lines, and reloaded/restarted PostgreSQL, you should be able to log in fine. Though of course so can anyone else with access to your machine.

            – Craig Ringer
            Nov 11 '15 at 10:24











          • Yes, I restarted Postgres Server. It's a part of pg_hba.conf Allow replication connections from localhost, by a user with the # replication privilege. #local replication postgres trust #host replication postgres 127.0.0.1/32 trust #host replication postgres ::1/128 trust

            – Alex
            Nov 11 '15 at 10:36













          • Ouch. I did it :) It seems I didn't close pg_hba.conf and tried to connect server)

            – Alex
            Nov 11 '15 at 10:43





















          • I've changed pg_hba.conf. I put 'trust' in place of 'peer'/'md5' of localhost.

            – Alex
            Nov 11 '15 at 10:21













          • @Alex If you did so for both host and local lines, and reloaded/restarted PostgreSQL, you should be able to log in fine. Though of course so can anyone else with access to your machine.

            – Craig Ringer
            Nov 11 '15 at 10:24











          • Yes, I restarted Postgres Server. It's a part of pg_hba.conf Allow replication connections from localhost, by a user with the # replication privilege. #local replication postgres trust #host replication postgres 127.0.0.1/32 trust #host replication postgres ::1/128 trust

            – Alex
            Nov 11 '15 at 10:36













          • Ouch. I did it :) It seems I didn't close pg_hba.conf and tried to connect server)

            – Alex
            Nov 11 '15 at 10:43



















          I've changed pg_hba.conf. I put 'trust' in place of 'peer'/'md5' of localhost.

          – Alex
          Nov 11 '15 at 10:21







          I've changed pg_hba.conf. I put 'trust' in place of 'peer'/'md5' of localhost.

          – Alex
          Nov 11 '15 at 10:21















          @Alex If you did so for both host and local lines, and reloaded/restarted PostgreSQL, you should be able to log in fine. Though of course so can anyone else with access to your machine.

          – Craig Ringer
          Nov 11 '15 at 10:24





          @Alex If you did so for both host and local lines, and reloaded/restarted PostgreSQL, you should be able to log in fine. Though of course so can anyone else with access to your machine.

          – Craig Ringer
          Nov 11 '15 at 10:24













          Yes, I restarted Postgres Server. It's a part of pg_hba.conf Allow replication connections from localhost, by a user with the # replication privilege. #local replication postgres trust #host replication postgres 127.0.0.1/32 trust #host replication postgres ::1/128 trust

          – Alex
          Nov 11 '15 at 10:36







          Yes, I restarted Postgres Server. It's a part of pg_hba.conf Allow replication connections from localhost, by a user with the # replication privilege. #local replication postgres trust #host replication postgres 127.0.0.1/32 trust #host replication postgres ::1/128 trust

          – Alex
          Nov 11 '15 at 10:36















          Ouch. I did it :) It seems I didn't close pg_hba.conf and tried to connect server)

          – Alex
          Nov 11 '15 at 10:43







          Ouch. I did it :) It seems I didn't close pg_hba.conf and tried to connect server)

          – Alex
          Nov 11 '15 at 10:43




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f696187%2fcant-to-log-in-postgres-account-by-pgadmin%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to make a Squid Proxy server?

          Is this a new Fibonacci Identity?

          19世紀