PostgreSQL user can not connect to server after changing password












10















I've met this with 4 roles I created:

After changing password for a user in pgAdmin III using the GUI (1), that user can not log in any more.

pgAdmin III show error message:



An error has occurred:

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


My system: Postgresql 9.2 on Ubuntu 12.04



Is there any way to fix this?



(1): login with account postgres, right click user in Login Roles, go to tab 'Definition' and enter password










share|improve this question





























    10















    I've met this with 4 roles I created:

    After changing password for a user in pgAdmin III using the GUI (1), that user can not log in any more.

    pgAdmin III show error message:



    An error has occurred:

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


    My system: Postgresql 9.2 on Ubuntu 12.04



    Is there any way to fix this?



    (1): login with account postgres, right click user in Login Roles, go to tab 'Definition' and enter password










    share|improve this question



























      10












      10








      10


      6






      I've met this with 4 roles I created:

      After changing password for a user in pgAdmin III using the GUI (1), that user can not log in any more.

      pgAdmin III show error message:



      An error has occurred:

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


      My system: Postgresql 9.2 on Ubuntu 12.04



      Is there any way to fix this?



      (1): login with account postgres, right click user in Login Roles, go to tab 'Definition' and enter password










      share|improve this question
















      I've met this with 4 roles I created:

      After changing password for a user in pgAdmin III using the GUI (1), that user can not log in any more.

      pgAdmin III show error message:



      An error has occurred:

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


      My system: Postgresql 9.2 on Ubuntu 12.04



      Is there any way to fix this?



      (1): login with account postgres, right click user in Login Roles, go to tab 'Definition' and enter password







      postgresql pgadmin-3






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 9 '17 at 20:06









      Evan Carroll

      31.7k967215




      31.7k967215










      asked Mar 7 '13 at 4:42









      Cao Minh TuCao Minh Tu

      283137




      283137






















          5 Answers
          5






          active

          oldest

          votes


















          15














          It's possible that you're being bitten by this PgAdmin bug (changelog):




          2012-11-28 AV 1.16.1 Date picker controls returns a full timestamp
          by
          default, which can cause inadvertent date changes
          on jobs and role validty dates. Ignore the time part.




          This bug has been seen to set password expiry dates far in the past, such as 1/1/1970. In this case the error message when trying to connect is no different than with a wrong password.



          You can check these expiry dates with:



          SELECT usename,valuntil FROM pg_user;


          and if they're wrong, reset them with:



          ALTER USER username VALID UNTIL 'infinity';


          and upgrade pgAdmin.






          share|improve this answer
























          • Thank you very much! This solved the problem. Every time I reset a user password, pgAdmin set the valid until time to 01-01-1970 so that user cannot log in any more.

            – Cao Minh Tu
            Mar 8 '13 at 0:55











          • you got it! damn bugs

            – Carter Cole
            Jan 2 '15 at 16:04











          • How exactly am I supposed to log in to psql??? That's the role I just updated.

            – ericpeters0n
            Apr 20 '16 at 21:34






          • 1





            @ericpeters0n: temporarily switch the authentication method to trust or peer in the pg_hba.conf file for this account.

            – Daniel Vérité
            Apr 21 '16 at 0:30











          • Thanks, got it sorted. For those that come later, the "trust" means that: Once you've restarted postgres, you can run psql without password authentication iff you're a user of the same name as a privileged user (e.g. username 'postgres')... So, 'su - postgres psql' will allow you to log in and correct the password or valid date.

            – ericpeters0n
            Apr 21 '16 at 7:15



















          3














          The simple thing to do is to log in with psql or pgAdmin and



          ALTER USER sam WITH PASSWORD 'new_password';


          Now, if you cannot log in with a superuser account you can recover by altering the pg_hba.conf settings for this user and reload the config (sometimes I find this requires restarting the server, but am not sure why).



          What you can do is add a line that allows you to log in using the ident (peer in 9.2) method (if you can use a local system account of the same name as the user) for local connections for the user, or (if that is not possible) set to "trust" (very temporarily!). If using trust, set back as soon as possible, since this means "trust that the user is who he/she claims!" and consequently this setting is dangerous to leave enabled outside of immediate recovery needs.



          Once you have logged in you can reset the password above.






          share|improve this answer


























          • Shouldn't pgAdmin perform just the same command?

            – dezso
            Mar 7 '13 at 9:06











          • (noting I said psql or pgAdmin. What can I do to make it clearer?)

            – Chris Travers
            Mar 7 '13 at 9:10











          • No-no, I just thought that changing passwords in the GUI does just the same. If it does I can't imagine what could go wrong?

            – dezso
            Mar 7 '13 at 10:35











          • What could go wrong? Typos in the password for starters....

            – Chris Travers
            Mar 7 '13 at 10:37











          • Can't one simply set the password again once logged in as postgres?

            – dezso
            Mar 7 '13 at 10:38



















          2














          For Windows variant - I too experienced this nasty bug because of pgAdmin for my Windows x64 install of version 9.2. It left my production paralyzed.



          In folder C:Program FilesPostgreSQL9.2data or C:Program Files (x86)PostgreSQL9.**x**data, you'll find the pg_hba.conf text file.



          Find the following lines:



          # TYPE  DATABASE        USER            ADDRESS                 METHOD

          # IPv4 local connections:
          host all all 127.0.0.1/32 md5
          # IPv6 local connections:
          host all all ::1/128 md5


          and change METHOD md5 to "trust" like this:



          # TYPE  DATABASE        USER            ADDRESS                 METHOD

          # IPv4 local connections:
          host all all 127.0.0.1/32 trust
          # IPv6 local connections:
          host all all ::1/128 trust


          From Windows>Run type "services.msc" and [enter]
          find the right PostgreSQL instance and restart it.



          Your DB security is now blown wide open! Heed the warning to return it back to md5 after changing the user password expiry time to say year 2099 for all the relevant users.






          share|improve this answer

































            1














            If you have not tried this already, review your pg_hba.conf file. It will be named something like /var/lib/pgsql/9.3/data/pg_hba.conf (Fedora 20); you may have to use 'find / -name pg_hba.conf' to locate it.



            At the bottom of the file, change the 'METHOD' values to 'trust' for local testing (see postgres docs for full information). Reboot the machine to ensure everything is started clean and the new params are read.



            Hopefully this will cure your woes. It solved my problems on Fedora 20 with PostgreSQL 9.3.



            UPDATE 2016-10-14:



            On Ubuntu, the needed filename is /etc/postgresql/9.5/main/pg_hba.conf. For local testing only, modify it to look like this:



            ...
            #
            # Database administrative login by Unix domain socket
            local all postgres peer

            # TYPE DATABASE USER ADDRESS METHOD

            # "local" is for Unix domain socket connections only
            # local all all peer
            local all all trust
            # IPv4 local connections:
            # host all all 127.0.0.1/32 md5
            host all all 127.0.0.1/32 trust


            The two lines with METHOD "trust" are new. They allow you to connect without a username/password.



            When complete, you will need to restart the server via:



            sudo systemctl restart postgresql 





            share|improve this answer


























            • For the pg_hba.conf to take effect, you need only a reload, not a restart. Furthermore, your suggestion looks incomplete as it is not clear how it would solve the issue in the end.

              – dezso
              Jul 26 '14 at 5:32



















            0














            I just had this same problem and it turned out that I had multiple users with the same name (differing cases). Once I merged the ownership and removed one, it was at least clear. Depending on the method of connection, the case was not necessarily transferred for authentication.






            share|improve this answer








            New contributor




            George is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.




















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "182"
              };
              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: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              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%2fdba.stackexchange.com%2fquestions%2f36137%2fpostgresql-user-can-not-connect-to-server-after-changing-password%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              5 Answers
              5






              active

              oldest

              votes








              5 Answers
              5






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              15














              It's possible that you're being bitten by this PgAdmin bug (changelog):




              2012-11-28 AV 1.16.1 Date picker controls returns a full timestamp
              by
              default, which can cause inadvertent date changes
              on jobs and role validty dates. Ignore the time part.




              This bug has been seen to set password expiry dates far in the past, such as 1/1/1970. In this case the error message when trying to connect is no different than with a wrong password.



              You can check these expiry dates with:



              SELECT usename,valuntil FROM pg_user;


              and if they're wrong, reset them with:



              ALTER USER username VALID UNTIL 'infinity';


              and upgrade pgAdmin.






              share|improve this answer
























              • Thank you very much! This solved the problem. Every time I reset a user password, pgAdmin set the valid until time to 01-01-1970 so that user cannot log in any more.

                – Cao Minh Tu
                Mar 8 '13 at 0:55











              • you got it! damn bugs

                – Carter Cole
                Jan 2 '15 at 16:04











              • How exactly am I supposed to log in to psql??? That's the role I just updated.

                – ericpeters0n
                Apr 20 '16 at 21:34






              • 1





                @ericpeters0n: temporarily switch the authentication method to trust or peer in the pg_hba.conf file for this account.

                – Daniel Vérité
                Apr 21 '16 at 0:30











              • Thanks, got it sorted. For those that come later, the "trust" means that: Once you've restarted postgres, you can run psql without password authentication iff you're a user of the same name as a privileged user (e.g. username 'postgres')... So, 'su - postgres psql' will allow you to log in and correct the password or valid date.

                – ericpeters0n
                Apr 21 '16 at 7:15
















              15














              It's possible that you're being bitten by this PgAdmin bug (changelog):




              2012-11-28 AV 1.16.1 Date picker controls returns a full timestamp
              by
              default, which can cause inadvertent date changes
              on jobs and role validty dates. Ignore the time part.




              This bug has been seen to set password expiry dates far in the past, such as 1/1/1970. In this case the error message when trying to connect is no different than with a wrong password.



              You can check these expiry dates with:



              SELECT usename,valuntil FROM pg_user;


              and if they're wrong, reset them with:



              ALTER USER username VALID UNTIL 'infinity';


              and upgrade pgAdmin.






              share|improve this answer
























              • Thank you very much! This solved the problem. Every time I reset a user password, pgAdmin set the valid until time to 01-01-1970 so that user cannot log in any more.

                – Cao Minh Tu
                Mar 8 '13 at 0:55











              • you got it! damn bugs

                – Carter Cole
                Jan 2 '15 at 16:04











              • How exactly am I supposed to log in to psql??? That's the role I just updated.

                – ericpeters0n
                Apr 20 '16 at 21:34






              • 1





                @ericpeters0n: temporarily switch the authentication method to trust or peer in the pg_hba.conf file for this account.

                – Daniel Vérité
                Apr 21 '16 at 0:30











              • Thanks, got it sorted. For those that come later, the "trust" means that: Once you've restarted postgres, you can run psql without password authentication iff you're a user of the same name as a privileged user (e.g. username 'postgres')... So, 'su - postgres psql' will allow you to log in and correct the password or valid date.

                – ericpeters0n
                Apr 21 '16 at 7:15














              15












              15








              15







              It's possible that you're being bitten by this PgAdmin bug (changelog):




              2012-11-28 AV 1.16.1 Date picker controls returns a full timestamp
              by
              default, which can cause inadvertent date changes
              on jobs and role validty dates. Ignore the time part.




              This bug has been seen to set password expiry dates far in the past, such as 1/1/1970. In this case the error message when trying to connect is no different than with a wrong password.



              You can check these expiry dates with:



              SELECT usename,valuntil FROM pg_user;


              and if they're wrong, reset them with:



              ALTER USER username VALID UNTIL 'infinity';


              and upgrade pgAdmin.






              share|improve this answer













              It's possible that you're being bitten by this PgAdmin bug (changelog):




              2012-11-28 AV 1.16.1 Date picker controls returns a full timestamp
              by
              default, which can cause inadvertent date changes
              on jobs and role validty dates. Ignore the time part.




              This bug has been seen to set password expiry dates far in the past, such as 1/1/1970. In this case the error message when trying to connect is no different than with a wrong password.



              You can check these expiry dates with:



              SELECT usename,valuntil FROM pg_user;


              and if they're wrong, reset them with:



              ALTER USER username VALID UNTIL 'infinity';


              and upgrade pgAdmin.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Mar 7 '13 at 14:42









              Daniel VéritéDaniel Vérité

              17k33551




              17k33551













              • Thank you very much! This solved the problem. Every time I reset a user password, pgAdmin set the valid until time to 01-01-1970 so that user cannot log in any more.

                – Cao Minh Tu
                Mar 8 '13 at 0:55











              • you got it! damn bugs

                – Carter Cole
                Jan 2 '15 at 16:04











              • How exactly am I supposed to log in to psql??? That's the role I just updated.

                – ericpeters0n
                Apr 20 '16 at 21:34






              • 1





                @ericpeters0n: temporarily switch the authentication method to trust or peer in the pg_hba.conf file for this account.

                – Daniel Vérité
                Apr 21 '16 at 0:30











              • Thanks, got it sorted. For those that come later, the "trust" means that: Once you've restarted postgres, you can run psql without password authentication iff you're a user of the same name as a privileged user (e.g. username 'postgres')... So, 'su - postgres psql' will allow you to log in and correct the password or valid date.

                – ericpeters0n
                Apr 21 '16 at 7:15



















              • Thank you very much! This solved the problem. Every time I reset a user password, pgAdmin set the valid until time to 01-01-1970 so that user cannot log in any more.

                – Cao Minh Tu
                Mar 8 '13 at 0:55











              • you got it! damn bugs

                – Carter Cole
                Jan 2 '15 at 16:04











              • How exactly am I supposed to log in to psql??? That's the role I just updated.

                – ericpeters0n
                Apr 20 '16 at 21:34






              • 1





                @ericpeters0n: temporarily switch the authentication method to trust or peer in the pg_hba.conf file for this account.

                – Daniel Vérité
                Apr 21 '16 at 0:30











              • Thanks, got it sorted. For those that come later, the "trust" means that: Once you've restarted postgres, you can run psql without password authentication iff you're a user of the same name as a privileged user (e.g. username 'postgres')... So, 'su - postgres psql' will allow you to log in and correct the password or valid date.

                – ericpeters0n
                Apr 21 '16 at 7:15

















              Thank you very much! This solved the problem. Every time I reset a user password, pgAdmin set the valid until time to 01-01-1970 so that user cannot log in any more.

              – Cao Minh Tu
              Mar 8 '13 at 0:55





              Thank you very much! This solved the problem. Every time I reset a user password, pgAdmin set the valid until time to 01-01-1970 so that user cannot log in any more.

              – Cao Minh Tu
              Mar 8 '13 at 0:55













              you got it! damn bugs

              – Carter Cole
              Jan 2 '15 at 16:04





              you got it! damn bugs

              – Carter Cole
              Jan 2 '15 at 16:04













              How exactly am I supposed to log in to psql??? That's the role I just updated.

              – ericpeters0n
              Apr 20 '16 at 21:34





              How exactly am I supposed to log in to psql??? That's the role I just updated.

              – ericpeters0n
              Apr 20 '16 at 21:34




              1




              1





              @ericpeters0n: temporarily switch the authentication method to trust or peer in the pg_hba.conf file for this account.

              – Daniel Vérité
              Apr 21 '16 at 0:30





              @ericpeters0n: temporarily switch the authentication method to trust or peer in the pg_hba.conf file for this account.

              – Daniel Vérité
              Apr 21 '16 at 0:30













              Thanks, got it sorted. For those that come later, the "trust" means that: Once you've restarted postgres, you can run psql without password authentication iff you're a user of the same name as a privileged user (e.g. username 'postgres')... So, 'su - postgres psql' will allow you to log in and correct the password or valid date.

              – ericpeters0n
              Apr 21 '16 at 7:15





              Thanks, got it sorted. For those that come later, the "trust" means that: Once you've restarted postgres, you can run psql without password authentication iff you're a user of the same name as a privileged user (e.g. username 'postgres')... So, 'su - postgres psql' will allow you to log in and correct the password or valid date.

              – ericpeters0n
              Apr 21 '16 at 7:15













              3














              The simple thing to do is to log in with psql or pgAdmin and



              ALTER USER sam WITH PASSWORD 'new_password';


              Now, if you cannot log in with a superuser account you can recover by altering the pg_hba.conf settings for this user and reload the config (sometimes I find this requires restarting the server, but am not sure why).



              What you can do is add a line that allows you to log in using the ident (peer in 9.2) method (if you can use a local system account of the same name as the user) for local connections for the user, or (if that is not possible) set to "trust" (very temporarily!). If using trust, set back as soon as possible, since this means "trust that the user is who he/she claims!" and consequently this setting is dangerous to leave enabled outside of immediate recovery needs.



              Once you have logged in you can reset the password above.






              share|improve this answer


























              • Shouldn't pgAdmin perform just the same command?

                – dezso
                Mar 7 '13 at 9:06











              • (noting I said psql or pgAdmin. What can I do to make it clearer?)

                – Chris Travers
                Mar 7 '13 at 9:10











              • No-no, I just thought that changing passwords in the GUI does just the same. If it does I can't imagine what could go wrong?

                – dezso
                Mar 7 '13 at 10:35











              • What could go wrong? Typos in the password for starters....

                – Chris Travers
                Mar 7 '13 at 10:37











              • Can't one simply set the password again once logged in as postgres?

                – dezso
                Mar 7 '13 at 10:38
















              3














              The simple thing to do is to log in with psql or pgAdmin and



              ALTER USER sam WITH PASSWORD 'new_password';


              Now, if you cannot log in with a superuser account you can recover by altering the pg_hba.conf settings for this user and reload the config (sometimes I find this requires restarting the server, but am not sure why).



              What you can do is add a line that allows you to log in using the ident (peer in 9.2) method (if you can use a local system account of the same name as the user) for local connections for the user, or (if that is not possible) set to "trust" (very temporarily!). If using trust, set back as soon as possible, since this means "trust that the user is who he/she claims!" and consequently this setting is dangerous to leave enabled outside of immediate recovery needs.



              Once you have logged in you can reset the password above.






              share|improve this answer


























              • Shouldn't pgAdmin perform just the same command?

                – dezso
                Mar 7 '13 at 9:06











              • (noting I said psql or pgAdmin. What can I do to make it clearer?)

                – Chris Travers
                Mar 7 '13 at 9:10











              • No-no, I just thought that changing passwords in the GUI does just the same. If it does I can't imagine what could go wrong?

                – dezso
                Mar 7 '13 at 10:35











              • What could go wrong? Typos in the password for starters....

                – Chris Travers
                Mar 7 '13 at 10:37











              • Can't one simply set the password again once logged in as postgres?

                – dezso
                Mar 7 '13 at 10:38














              3












              3








              3







              The simple thing to do is to log in with psql or pgAdmin and



              ALTER USER sam WITH PASSWORD 'new_password';


              Now, if you cannot log in with a superuser account you can recover by altering the pg_hba.conf settings for this user and reload the config (sometimes I find this requires restarting the server, but am not sure why).



              What you can do is add a line that allows you to log in using the ident (peer in 9.2) method (if you can use a local system account of the same name as the user) for local connections for the user, or (if that is not possible) set to "trust" (very temporarily!). If using trust, set back as soon as possible, since this means "trust that the user is who he/she claims!" and consequently this setting is dangerous to leave enabled outside of immediate recovery needs.



              Once you have logged in you can reset the password above.






              share|improve this answer















              The simple thing to do is to log in with psql or pgAdmin and



              ALTER USER sam WITH PASSWORD 'new_password';


              Now, if you cannot log in with a superuser account you can recover by altering the pg_hba.conf settings for this user and reload the config (sometimes I find this requires restarting the server, but am not sure why).



              What you can do is add a line that allows you to log in using the ident (peer in 9.2) method (if you can use a local system account of the same name as the user) for local connections for the user, or (if that is not possible) set to "trust" (very temporarily!). If using trust, set back as soon as possible, since this means "trust that the user is who he/she claims!" and consequently this setting is dangerous to leave enabled outside of immediate recovery needs.



              Once you have logged in you can reset the password above.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Mar 7 '13 at 9:06









              dezso

              21.7k115895




              21.7k115895










              answered Mar 7 '13 at 7:19









              Chris TraversChris Travers

              10.9k3788




              10.9k3788













              • Shouldn't pgAdmin perform just the same command?

                – dezso
                Mar 7 '13 at 9:06











              • (noting I said psql or pgAdmin. What can I do to make it clearer?)

                – Chris Travers
                Mar 7 '13 at 9:10











              • No-no, I just thought that changing passwords in the GUI does just the same. If it does I can't imagine what could go wrong?

                – dezso
                Mar 7 '13 at 10:35











              • What could go wrong? Typos in the password for starters....

                – Chris Travers
                Mar 7 '13 at 10:37











              • Can't one simply set the password again once logged in as postgres?

                – dezso
                Mar 7 '13 at 10:38



















              • Shouldn't pgAdmin perform just the same command?

                – dezso
                Mar 7 '13 at 9:06











              • (noting I said psql or pgAdmin. What can I do to make it clearer?)

                – Chris Travers
                Mar 7 '13 at 9:10











              • No-no, I just thought that changing passwords in the GUI does just the same. If it does I can't imagine what could go wrong?

                – dezso
                Mar 7 '13 at 10:35











              • What could go wrong? Typos in the password for starters....

                – Chris Travers
                Mar 7 '13 at 10:37











              • Can't one simply set the password again once logged in as postgres?

                – dezso
                Mar 7 '13 at 10:38

















              Shouldn't pgAdmin perform just the same command?

              – dezso
              Mar 7 '13 at 9:06





              Shouldn't pgAdmin perform just the same command?

              – dezso
              Mar 7 '13 at 9:06













              (noting I said psql or pgAdmin. What can I do to make it clearer?)

              – Chris Travers
              Mar 7 '13 at 9:10





              (noting I said psql or pgAdmin. What can I do to make it clearer?)

              – Chris Travers
              Mar 7 '13 at 9:10













              No-no, I just thought that changing passwords in the GUI does just the same. If it does I can't imagine what could go wrong?

              – dezso
              Mar 7 '13 at 10:35





              No-no, I just thought that changing passwords in the GUI does just the same. If it does I can't imagine what could go wrong?

              – dezso
              Mar 7 '13 at 10:35













              What could go wrong? Typos in the password for starters....

              – Chris Travers
              Mar 7 '13 at 10:37





              What could go wrong? Typos in the password for starters....

              – Chris Travers
              Mar 7 '13 at 10:37













              Can't one simply set the password again once logged in as postgres?

              – dezso
              Mar 7 '13 at 10:38





              Can't one simply set the password again once logged in as postgres?

              – dezso
              Mar 7 '13 at 10:38











              2














              For Windows variant - I too experienced this nasty bug because of pgAdmin for my Windows x64 install of version 9.2. It left my production paralyzed.



              In folder C:Program FilesPostgreSQL9.2data or C:Program Files (x86)PostgreSQL9.**x**data, you'll find the pg_hba.conf text file.



              Find the following lines:



              # TYPE  DATABASE        USER            ADDRESS                 METHOD

              # IPv4 local connections:
              host all all 127.0.0.1/32 md5
              # IPv6 local connections:
              host all all ::1/128 md5


              and change METHOD md5 to "trust" like this:



              # TYPE  DATABASE        USER            ADDRESS                 METHOD

              # IPv4 local connections:
              host all all 127.0.0.1/32 trust
              # IPv6 local connections:
              host all all ::1/128 trust


              From Windows>Run type "services.msc" and [enter]
              find the right PostgreSQL instance and restart it.



              Your DB security is now blown wide open! Heed the warning to return it back to md5 after changing the user password expiry time to say year 2099 for all the relevant users.






              share|improve this answer






























                2














                For Windows variant - I too experienced this nasty bug because of pgAdmin for my Windows x64 install of version 9.2. It left my production paralyzed.



                In folder C:Program FilesPostgreSQL9.2data or C:Program Files (x86)PostgreSQL9.**x**data, you'll find the pg_hba.conf text file.



                Find the following lines:



                # TYPE  DATABASE        USER            ADDRESS                 METHOD

                # IPv4 local connections:
                host all all 127.0.0.1/32 md5
                # IPv6 local connections:
                host all all ::1/128 md5


                and change METHOD md5 to "trust" like this:



                # TYPE  DATABASE        USER            ADDRESS                 METHOD

                # IPv4 local connections:
                host all all 127.0.0.1/32 trust
                # IPv6 local connections:
                host all all ::1/128 trust


                From Windows>Run type "services.msc" and [enter]
                find the right PostgreSQL instance and restart it.



                Your DB security is now blown wide open! Heed the warning to return it back to md5 after changing the user password expiry time to say year 2099 for all the relevant users.






                share|improve this answer




























                  2












                  2








                  2







                  For Windows variant - I too experienced this nasty bug because of pgAdmin for my Windows x64 install of version 9.2. It left my production paralyzed.



                  In folder C:Program FilesPostgreSQL9.2data or C:Program Files (x86)PostgreSQL9.**x**data, you'll find the pg_hba.conf text file.



                  Find the following lines:



                  # TYPE  DATABASE        USER            ADDRESS                 METHOD

                  # IPv4 local connections:
                  host all all 127.0.0.1/32 md5
                  # IPv6 local connections:
                  host all all ::1/128 md5


                  and change METHOD md5 to "trust" like this:



                  # TYPE  DATABASE        USER            ADDRESS                 METHOD

                  # IPv4 local connections:
                  host all all 127.0.0.1/32 trust
                  # IPv6 local connections:
                  host all all ::1/128 trust


                  From Windows>Run type "services.msc" and [enter]
                  find the right PostgreSQL instance and restart it.



                  Your DB security is now blown wide open! Heed the warning to return it back to md5 after changing the user password expiry time to say year 2099 for all the relevant users.






                  share|improve this answer















                  For Windows variant - I too experienced this nasty bug because of pgAdmin for my Windows x64 install of version 9.2. It left my production paralyzed.



                  In folder C:Program FilesPostgreSQL9.2data or C:Program Files (x86)PostgreSQL9.**x**data, you'll find the pg_hba.conf text file.



                  Find the following lines:



                  # TYPE  DATABASE        USER            ADDRESS                 METHOD

                  # IPv4 local connections:
                  host all all 127.0.0.1/32 md5
                  # IPv6 local connections:
                  host all all ::1/128 md5


                  and change METHOD md5 to "trust" like this:



                  # TYPE  DATABASE        USER            ADDRESS                 METHOD

                  # IPv4 local connections:
                  host all all 127.0.0.1/32 trust
                  # IPv6 local connections:
                  host all all ::1/128 trust


                  From Windows>Run type "services.msc" and [enter]
                  find the right PostgreSQL instance and restart it.



                  Your DB security is now blown wide open! Heed the warning to return it back to md5 after changing the user password expiry time to say year 2099 for all the relevant users.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jul 21 '15 at 6:03









                  Paul White

                  49.5k14261415




                  49.5k14261415










                  answered Jul 21 '15 at 3:54









                  Hoang DoHoang Do

                  211




                  211























                      1














                      If you have not tried this already, review your pg_hba.conf file. It will be named something like /var/lib/pgsql/9.3/data/pg_hba.conf (Fedora 20); you may have to use 'find / -name pg_hba.conf' to locate it.



                      At the bottom of the file, change the 'METHOD' values to 'trust' for local testing (see postgres docs for full information). Reboot the machine to ensure everything is started clean and the new params are read.



                      Hopefully this will cure your woes. It solved my problems on Fedora 20 with PostgreSQL 9.3.



                      UPDATE 2016-10-14:



                      On Ubuntu, the needed filename is /etc/postgresql/9.5/main/pg_hba.conf. For local testing only, modify it to look like this:



                      ...
                      #
                      # Database administrative login by Unix domain socket
                      local all postgres peer

                      # TYPE DATABASE USER ADDRESS METHOD

                      # "local" is for Unix domain socket connections only
                      # local all all peer
                      local all all trust
                      # IPv4 local connections:
                      # host all all 127.0.0.1/32 md5
                      host all all 127.0.0.1/32 trust


                      The two lines with METHOD "trust" are new. They allow you to connect without a username/password.



                      When complete, you will need to restart the server via:



                      sudo systemctl restart postgresql 





                      share|improve this answer


























                      • For the pg_hba.conf to take effect, you need only a reload, not a restart. Furthermore, your suggestion looks incomplete as it is not clear how it would solve the issue in the end.

                        – dezso
                        Jul 26 '14 at 5:32
















                      1














                      If you have not tried this already, review your pg_hba.conf file. It will be named something like /var/lib/pgsql/9.3/data/pg_hba.conf (Fedora 20); you may have to use 'find / -name pg_hba.conf' to locate it.



                      At the bottom of the file, change the 'METHOD' values to 'trust' for local testing (see postgres docs for full information). Reboot the machine to ensure everything is started clean and the new params are read.



                      Hopefully this will cure your woes. It solved my problems on Fedora 20 with PostgreSQL 9.3.



                      UPDATE 2016-10-14:



                      On Ubuntu, the needed filename is /etc/postgresql/9.5/main/pg_hba.conf. For local testing only, modify it to look like this:



                      ...
                      #
                      # Database administrative login by Unix domain socket
                      local all postgres peer

                      # TYPE DATABASE USER ADDRESS METHOD

                      # "local" is for Unix domain socket connections only
                      # local all all peer
                      local all all trust
                      # IPv4 local connections:
                      # host all all 127.0.0.1/32 md5
                      host all all 127.0.0.1/32 trust


                      The two lines with METHOD "trust" are new. They allow you to connect without a username/password.



                      When complete, you will need to restart the server via:



                      sudo systemctl restart postgresql 





                      share|improve this answer


























                      • For the pg_hba.conf to take effect, you need only a reload, not a restart. Furthermore, your suggestion looks incomplete as it is not clear how it would solve the issue in the end.

                        – dezso
                        Jul 26 '14 at 5:32














                      1












                      1








                      1







                      If you have not tried this already, review your pg_hba.conf file. It will be named something like /var/lib/pgsql/9.3/data/pg_hba.conf (Fedora 20); you may have to use 'find / -name pg_hba.conf' to locate it.



                      At the bottom of the file, change the 'METHOD' values to 'trust' for local testing (see postgres docs for full information). Reboot the machine to ensure everything is started clean and the new params are read.



                      Hopefully this will cure your woes. It solved my problems on Fedora 20 with PostgreSQL 9.3.



                      UPDATE 2016-10-14:



                      On Ubuntu, the needed filename is /etc/postgresql/9.5/main/pg_hba.conf. For local testing only, modify it to look like this:



                      ...
                      #
                      # Database administrative login by Unix domain socket
                      local all postgres peer

                      # TYPE DATABASE USER ADDRESS METHOD

                      # "local" is for Unix domain socket connections only
                      # local all all peer
                      local all all trust
                      # IPv4 local connections:
                      # host all all 127.0.0.1/32 md5
                      host all all 127.0.0.1/32 trust


                      The two lines with METHOD "trust" are new. They allow you to connect without a username/password.



                      When complete, you will need to restart the server via:



                      sudo systemctl restart postgresql 





                      share|improve this answer















                      If you have not tried this already, review your pg_hba.conf file. It will be named something like /var/lib/pgsql/9.3/data/pg_hba.conf (Fedora 20); you may have to use 'find / -name pg_hba.conf' to locate it.



                      At the bottom of the file, change the 'METHOD' values to 'trust' for local testing (see postgres docs for full information). Reboot the machine to ensure everything is started clean and the new params are read.



                      Hopefully this will cure your woes. It solved my problems on Fedora 20 with PostgreSQL 9.3.



                      UPDATE 2016-10-14:



                      On Ubuntu, the needed filename is /etc/postgresql/9.5/main/pg_hba.conf. For local testing only, modify it to look like this:



                      ...
                      #
                      # Database administrative login by Unix domain socket
                      local all postgres peer

                      # TYPE DATABASE USER ADDRESS METHOD

                      # "local" is for Unix domain socket connections only
                      # local all all peer
                      local all all trust
                      # IPv4 local connections:
                      # host all all 127.0.0.1/32 md5
                      host all all 127.0.0.1/32 trust


                      The two lines with METHOD "trust" are new. They allow you to connect without a username/password.



                      When complete, you will need to restart the server via:



                      sudo systemctl restart postgresql 






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Oct 14 '16 at 16:10

























                      answered Jul 26 '14 at 1:03









                      Alan ThompsonAlan Thompson

                      1113




                      1113













                      • For the pg_hba.conf to take effect, you need only a reload, not a restart. Furthermore, your suggestion looks incomplete as it is not clear how it would solve the issue in the end.

                        – dezso
                        Jul 26 '14 at 5:32



















                      • For the pg_hba.conf to take effect, you need only a reload, not a restart. Furthermore, your suggestion looks incomplete as it is not clear how it would solve the issue in the end.

                        – dezso
                        Jul 26 '14 at 5:32

















                      For the pg_hba.conf to take effect, you need only a reload, not a restart. Furthermore, your suggestion looks incomplete as it is not clear how it would solve the issue in the end.

                      – dezso
                      Jul 26 '14 at 5:32





                      For the pg_hba.conf to take effect, you need only a reload, not a restart. Furthermore, your suggestion looks incomplete as it is not clear how it would solve the issue in the end.

                      – dezso
                      Jul 26 '14 at 5:32











                      0














                      I just had this same problem and it turned out that I had multiple users with the same name (differing cases). Once I merged the ownership and removed one, it was at least clear. Depending on the method of connection, the case was not necessarily transferred for authentication.






                      share|improve this answer








                      New contributor




                      George is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.

























                        0














                        I just had this same problem and it turned out that I had multiple users with the same name (differing cases). Once I merged the ownership and removed one, it was at least clear. Depending on the method of connection, the case was not necessarily transferred for authentication.






                        share|improve this answer








                        New contributor




                        George is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.























                          0












                          0








                          0







                          I just had this same problem and it turned out that I had multiple users with the same name (differing cases). Once I merged the ownership and removed one, it was at least clear. Depending on the method of connection, the case was not necessarily transferred for authentication.






                          share|improve this answer








                          New contributor




                          George is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.










                          I just had this same problem and it turned out that I had multiple users with the same name (differing cases). Once I merged the ownership and removed one, it was at least clear. Depending on the method of connection, the case was not necessarily transferred for authentication.







                          share|improve this answer








                          New contributor




                          George is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          share|improve this answer



                          share|improve this answer






                          New contributor




                          George is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          answered 10 mins ago









                          GeorgeGeorge

                          1




                          1




                          New contributor




                          George is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.





                          New contributor





                          George is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






                          George is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Database Administrators Stack Exchange!


                              • 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%2fdba.stackexchange.com%2fquestions%2f36137%2fpostgresql-user-can-not-connect-to-server-after-changing-password%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

                              SQL Server 17 - Attemping to backup to remote NAS but Access is denied

                              Always On Availability groups resolving state after failover - Remote harden of transaction...

                              Restoring from pg_dump with foreign key constraints