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?
i think this is your answer
in my windows 10 databases locate at " C:/Program Files/PostgreSQL/12/data"
you can use this command