0

I am using Ubuntu 20.04 LTS, and I have configured PostgreSQL 9.5 to work on the server. I am trying to log in but I have forgotten the password for the user postgres and therefore I tried to reset it by using the suggestions in the forum.

As it did not work for me I tried to check what was happening. First, I saw that I have two services of PostgreSQL available on my server: 10 and 9.5. PostgreSQL 10 is configured to be running in docker while 9.5 is running in the server (for 2 different applications). This can be seen in the screenshot below: enter image description here

I stopped PostgreSQL using: sudo systemctl stop postgresql and when I check for the status of the service, it has already stopped. This can be seen in the image below: enter image description here

Even after stopping the PostgreSQL service, I saw that my applications were running correctly and I could access all the data in both applications. Then I try to see if there is anything running in port 5432 where my PostgreSQL service is configured to run and I see the following: enter image description here

The PostgreSQL service is running but I do not know where it is located. Does anybody here have an idea, how to solve this problem without losing the data from both databases?

2
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Sep 15, 2021 at 13:09
  • Well, in order to be able to reset the password of the PostgreSQL, I should find the appropriate place where, the PostgreSQL that is running, is located. That is why my question is about and how it can be possible that after stoping the PostgreSQL service, the databases are still running? Sep 15, 2021 at 13:23

1 Answer 1

0

you can probably find it with ps -efl|fgrep /postgre.

0 S postgres    1080       1  0  80   0 - 41587 -      Sep11 ?        00:00:03 /usr/local/pgsql/bin/postgres -D data

In this case, since the argument to -D was a relative path not an absolute one, the answer is not totally complete. But at least you know the name of the directory to search for, you can use find or some other OS tool to search.

4
  • thank you for the answer. I tried the command that you suggested and this is what I get from that one. 0 S busymo16 11127 11019 0 80 0 - 3609 pipe_w 09:30 pts/0 00:00:00 grep -F --color=auto /postgre 0 S postgres 17463 1 0 80 0 - 75890 - Aug18 ? 00:01:39 /usr/lib/postgresql/9.5/bin/postgres -c config_file=/etc/postgresql/9.5/main/postgresql.conf I can confirm that in this directory: /etc/postgresql/9.5/main/postgresql.conf, I have access and I can do the changes but still that is not the correct conf for my PostgreSQL service that is still running. Sep 17, 2021 at 7:44
  • @FatjonLala Why do you think that that is not the one that is running?
    – jjanes
    Sep 17, 2021 at 23:14
  • because I stopped it and when I see the location of the conf file of the database, it is the same as the one that I stopped. Therefore it can not be running because I stopped it. Sep 19, 2021 at 15:39
  • If it still shows up in ps, then I think the safer conclusion is that your attempt to stop it failed.
    – jjanes
    Sep 19, 2021 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.