Free to install PostgreSQL startup service and CREATE database

Source: Internet
Author: User
Tags locale postgresql

Installation Environment Windows7 64-bit system

Free Install version postgresql-10.3-1-windows-x64-binaries

=======================================

Decompression after unable to connect to the database, PGADMIN4 can not start, online to find a variety of methods, finally have a can start, and unable to create a server and database, tried a lot of methods finally succeeded, recorded:

1. First to http://www.enterprisedb.com/products/pgbindownload.do download the PostgreSQL program, I downloaded is win x64version 10.3-1;

2. After downloading the Pgsql folder in the compressed package extracted, for convenience, I put directly to E:\pgsql, do not install, but need to set the environment variables ...

3. Make a simple batch file yourself, I call postgresql-10.3x64-1_install.bat here, can be arbitrarily named:

Set Pghome=e:\pgsql
Set path=%pghome%\bin;%path%
Set Pghost=localhost
Set Pglib=%pghome%\lib
Set Pgdata=%pghome%\data

Copy this batch file to E:\pgsql

4. Open cmd, switch to your pgsql directory, I am E:\pgsql, run Postgresql-10.3x64-1_install.bat

C:\users\administrator>e:
E:\>CD E:\pgsql
E:\pgsql>inst
E:\pgsql>set Pghome=e:\pgsql
E:\pgsql>set Path=e:\pgsql\bin; E:\Python26\Scripts; E:\Python26\; C:\Windows\syste
M32; C:\Windows; C:\Windows\System32\Wbem; C:\Windows\System32\WindowsPowerShell\v1
.0\; C:\Program Files\Common Files\thundernetwork\kankan\codecs; C:\Users\Adminis
trator\appdata\roaming\python\scripts; E:\Program files\google\google_appengine\
E:\pgsql>set Pghost=localhost
E:\pgsql>set Pglib=e:\pgsql\lib
E:\pgsql>set Pgdata=e:\pgsql\data

5. Initializing the database

E:\pgsql>initdb--locale=c
The file host for this database system is the user "Administrator".
This user must also be the host for the server process. The
Database cluster will be initialized with  locale C. The
Default database encoding has been set to  sql_ascii accordingly.
The default text search configuration will be set to "中文版"
to create the directory  e:/pgsql/data ... Successful
Creating subdirectory   .... Successful
Select default maximum number of joins   (max_connections) ...
Select default shared buffer size   (shared_buffers) ... 32MB
Create profile  ...  success
Create  template1 database in  E:/PGSQL/DATA/BASE/1   Successful
Initialize  pg_authid ... Successful
Initialize dependencies ... Successful
Create system view  ...  success
Loading system object Description   Successful
Create character set conversion   ..... Successful
Creating dictionary  ...  Success
setting permissions on built-in objects  . Successful

Create Information mode ... Success
Loading Pl/pgsql server-side language ... Success
Clean Database template1 ... Success
Copy Template1 to Template0 ... Success
Copy Template1 to Template0 ... Success
Warning: "Trust" authentication has been initiated for the local connection.
You can change by editing pg_hba.conf or you are under
Use the-a option when running INITDB.
Success. You can now run the database server with the following command:
"" Postmaster-d "E:/pgsql/data"
Or
"" Pg_ctl-d "E:/pgsql/data"-l E:\pgsql\pgdata.log Start


6. Start

E:\pgsql>pg_ctl start
Starting server process
E:\pgsql>log:database system was shut down at 2010-12-13 13:41:20 HKT
Log:autovacuum Launcher started
Log:database system is ready to accept connections

7. Create a Database

e:\pgsql>e:\pgsql\bin\createdb-h127.0.0.1 MyDB

Create user

E:\pgsql>e:\pgsql\bin\createuser-h 127.0.0.1 username
Is the new role a super user? (y/n) Y
E:\pgsql>

8. Open the graphical operator interface to manage the database E:\pgsql\bin\pgAdmin4.exe

Pgadmin 4/venv/lib/site-packages/backports/__init__.py Create a new 0-byte empty file __init__.py in this directory, and PGADMIN4 will work properly. I don't know why. Methods found on the web.


Name: Any

hostname/address:127.0.0.1

Username: Any

Password: Self-remembering, with uppercase and lowercase alphanumeric special characters, the appropriate length

Shutdown restart required to restart the service, PGADMIN4 to open. Otherwise it will be an error.

Win+r run cmd, enter the command

E:\pgsql\bin\pg_ctl-D "E:/pgsql/data"-l E:\pgsql\pgdata.log Start

You can also save the above command as a PostgreSQL service Start.bat

9. Use Dbeaver 5.0 can also open

Free to install PostgreSQL startup service and CREATE database

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.