-1

How do I create a (new) Postgres instance on Windows

Something along the lines: C:\postgresql\psql --create-server -name=MyAwesomeServer -host=localhost, etc.etc.

I want to specify everything needed to create an instance on the command line rather than using a gui. That way I can port all/most of it to a different platform.

JDOaktown
  • 99
  • 1
  • 5

3 Answers3

2

That does not create an actual server. It creates a record within pgadmin4 about how to connect to a server. Yes, it is poorly named. It should be called "create connection" or "configure connection" or something like that.

You create a server using initdb.exe, or using pg_ctl.exe with the 'initdb' action. (The installer you use to install the software may have created a server for you automatically).

jjanes
  • 42,332
  • 3
  • 44
  • 54
1

pgAdmin 4 stores Connection settings in a SqlLite database.
See this DBA StackExchange posting.

pgAdmin 3 on Windows used to store them in the Windows Registry.

Phill W.
  • 9,889
  • 1
  • 12
  • 24
0

In Windows 10 using initdb and pg_ctl

mkdir C:\MyAwesomeDB 
C:\PostgreSQL\13\bin\initdb -U MyAwesomeUserID -W -D C:\MyAwesomeDB

C:\PostgreSQL\13\bin\pg_ctl.exe -D C:\MyAwesomeDB -l logfile start C:\PostgreSQL\13\bin\pg_ctl.exe stop -D C:\MyAwesomeDB

JDOaktown
  • 99
  • 1
  • 5