Note that the download is a binary version, not a Windows installer.
Http://www.enterprisedb.com/products-services-training/pgbindownload
Download idea from x86
Before performing the following steps, make the following assumptions:
PostgreSQL is to be installed in the D: \ PostgreSQL database and then stored in the D: \ PostgreSQL \ data first download the latest version of postgresql-9.2.4-1-windows-x64-binaries.zip to be used. Follow these steps to manually install PostgreSQL, initialize the database, and register PostgreSQL as a service. 1. Unzip postgresql.zip to D: \ PostgreSQL and create a data directory;
2. Set the environment variable and edit the environment variable of the batch file configuration. vbs (valid permanently)
A) the content is as follows:
On Error resume nextset sysenv = Createobject ("wscript. shell "). environment ("system") 'array object of the system environment variable Path = Createobject ("scripting. fileSystemObject "). getfolder (". "). path 'add variable sysenv ("pghome") = "D: \ pgsql" sysenv ("pghost") = "localhost" sysenv ("path") = sysenv ("pghome ") + "\ bin;" + sysenv ("path") sysenv ("pglib") = sysenv ("pghome") + "\ Lib" sysenv ("pgdata ") = sysenv ("pghome") + "\ data" wscript. echo "PostgreSQL environment variable installation successful! No need to restart the computer! "
B) perform the following:
3. Right-click shift in the blank space, open a new cmd window, and CD to D: \ PostgreSQL \ bin;
4. initialize and create a database (once)
initdb.exe -D d:\postgresql\data -E UTF-8 --locale=chs -U postgres -W
-D: Specifies the storage directory of the Database Cluster E: \ pgsql \ data
-E: Specify the database superuser username Postgres
-- Locale: About region settings (Chinese-simplified-China)
-U: the default encoding format is chs.
-W: Prompt for specifying a password for a Super User
As follows:
4. Start the database
Note: If you are not registered as a system service, you must manually start the service each time. Otherwise, pgadmin3 fails to connect to the database.
Pg_ctl-d: \ postgresql-l logfile start
Shown as follows:
After it is started, A logfile file is generated under the main directory installed in the database: D: \ PostgreSQL \ logfile
5. Register as a Win8 System Service
Note: You must have the administrator privilege. Run the registration command as the Win8 administrator. The command is automatically started after restart. During registration, note that the double quotation marks are in the "half-width" Format: "instead of" ". Otherwise, PostgreSQL cannot be started after registration.
pg_ctl register -N PostgreSQL -D D:\postgresql\data
Because the double quotation marks were incorrect for the first time, the quotation marks were marked again, but the registration was successful.
- View the registered service: Win + R in the pop-up dialog box, enter services. msc, as shown below:
- Check whether the task is started: Enter tasklist in the command line.
- Netstat-An allows you to view all IP addresses that are connected to a local computer.
- Uninstall a service: you also need administrator permissions.
1) pg_ctl unregister-N PostgreSQL (Win8)
2) SC Delete PostgreSQL (PostgreSQL)
6. Configure the pgadmin3 Client
Directory: D: \ PostgreSQL \ bin \ pgadmin3, double-click to configure
7. Database Connection successful
How can PostgreSQL support remote login?
You only need to configure
Modify two files:
Pg_mirror.conf
PostgreSQL. conf
-----------------
For example, the IP address of the DB server in the environment is 10.10.3.5,
The Client IP address is 10.10.3.5.
Add the following in the PostgreSQL. conf file:
Listen_addresses = '*'
Add:
Host All all 10.10.3.1/24 Trust
24 indicates that the mask is 255.255.255.0, so it indicates that all IP addresses in this subnet are open.
You can access 10.10.3.5 on 10.10.3.5.
Run
C: \ windows \ system32> net stop postsql
C: \ windows \ system32> Net start postsql