0

I installed PostgreSQL 12.4 on MacOS using the EDB Installer (selected all the default options during installation). Using the pgAdmin 4 GUI client, I created a database, let's call it "A". I then uninstalled everything using the uninstaller that came with the EDB Installer. This didn't delete one subfolder: /Library/PostgreSQL/12/data. I deleted this manually.

I later installed PostgreSQL 12.4 again, in the exact same way. I fired up pgAdmin 4 and, unsurprisingly, it recognised only one database in existence: the default "postgres" database. I then tried to create a database named "A", but it would not let me, instead giving me an error along the lines of "a database of this name already exists".

Confused, I fired up the command-line client, psql, and executed the "\l" command. Indeed, a database named "A" showed up.

This brings me to my question:

Where does PostgreSQL store my databases? Why, when I uninstalled and then reinstalled, could pgAdmin 4 not show me that database "A" exists (but it clearly knew it existed), yet psql could?

Baran Karakus
  • 193
  • 1
  • 7

1 Answers1

0

i think this is your answer

in my windows 10 databases locate at " C:/Program Files/PostgreSQL/12/data"

you can use this command

show data_directory;
Ali Mirghasemi
  • 462
  • 2
  • 7
  • I've seen this answer. Running this returns /Library/Postgres/12/data for me. But I actually deleted this directory when I uninstalled PostgreSQL. – Baran Karakus Sep 26 '20 at 12:11