Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
344 views
in Technique[技术] by (71.8m points)

starting postgresql and pgadmin in windows without installation

How can I start PostgreSQL and pgAdmin III in windows without installation. I do not have admin rights in a system. so I need to start the application without installing . How can I do that?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  1. Download the ZIP file from https://www.enterprisedb.com/products-services-training/pgbindownload

  2. Unzip the archive into a directory of your choice (the archive is created such that unzipping it, it will create a directory pgsql with everything else below that)

  3. Run initdb (this can be found in the subdirectory pgsqlin)

     initdb -D c:UsersArthurpgdata -U postgres -W -E UTF8 -A scram-sha-256
    

    This will create the postgres "data directory" (aka the "cluster") in c:UsersArthurpgdata. You need to make sure that the user running this command has full read/write privileges on that directory.

    -U postgres creates the superuser as postgres, -W will prompt you for the password of the superuser, -E UTF8 will create the database with UTF-8 encoding and -A scram-sha-256 enables the password authentication.

  4. To start Postgres, run:

     pg_ctl -D c:UsersArthurpgdata -l logfile start
    

    this has(!) to be done as the user who ran initdb to avoid any problems with the access to the data directory.

  5. To shutdown Postgres, run:

     pg_ctl -D c:UsersArthurpgdata stop
    
  6. psql.exe (the command line client) is located in the bin directory. Starting with Postgres 9.6 the pgAdmin executable pgAdmin4.exe is located in the sub-directory "pgAdmin 4in".

  7. Optionally create a Windows service to automatically run Postgres (must be run using a Windows administrator account)

     pg_ctl register -N postgresql -D c:UsersArthurpgdata 
    

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...