Windows under PostgreSQL installation diagram This article is mainly for you to introduce the method of installing PostgreSQL database under Windows, you need a friend can refer to the following
Now talk about the free database, most people think of the first may be MySQL, indeed MySQL has been used in many areas of the country, especially the site. However, the most powerful, feature-rich, and most complex free databases are actually PostgreSQL. Many of its features are the predecessor of today's many commercial databases such as Oracle, DB2, etc.
In fact, I recently also because of the project needs, contact with the fur of PostgreSQL, recently PostgreSQL has just released the 8.1 version, the author of the online master experience to talk about a bit of their own installation experiences, and only began to contact PostgreSQL Novice friends to learn together.
Starting with PostgreSQL 8.0, Windows has been officially supported, and before that, if you want to install PostgreSQL on Windows, using tools like Cygwin to emulate the UNIX environment, Therefore, the stability and performance are lower than the Linux installation version. Cut the crap, let's get to the point.
Download PostgreSQL for Windows
Login to http://www.postgresql.org/ftp/, download the latest version, support multi-language installation.
Start installation
After downloading the installation file to local, unpack the package with the Unzip tool, and then double-click Postgresql-8.1.msi to start the Installation Wizard as you would any other Windows application.
The first is the selection of the installation process used in the language, the author found one side did not find Chinese, had to choose to know English ^_^. Alternatively, you can choose the bottom-most option to write the detailed installation log to the current installation directory for troubleshooting installation, or to read about the installation process.
|
Select the installation language |
The next step is to choose the option to install content, which is divided into four parts, namely database server side, user interface, database driver and development module. You can choose to install as needed. In order to understand more things, I put four parts all loaded. Also note here is that the Data directory option can only be installed in NTFS-formatted partitions, if you want to install in other formats, you need to manually run Initdb.exe after installation.
|
Select installation Options 1 |
|
Select installation Options 2 |
Tip: If you prefer to use the graphical interface to manage the operational database, you can choose to install PGADMINIII in the user interface.
Next is the service configuration, where you can run the database server as a system service for Windows, which is a manifestation of PostgreSQL starting to really support Windows installation (for example).
|
Select Install as Service |
Set the service name here, as well as the Windows account that runs the service. You can enter an existing account, or you can enter an account that does not currently exist and let the installer set up the account automatically. The account Domain entry represents the full computer name on your computer, which can be copied to the "My Computer"-right-click Property-Computer name, with the name of a full computer in it (for example, on my machine: cao-393d0fd737d). The last point of the name is not copied and pasted into the account domain item (note that you can only paste with the fast intercept key Ctrl + V).
|
Create an account automatically |
After you have created your account, you are configuring the database's listening port, connection license, and settings for the local area and Superuser. It is important to note that port number represents the listening port for configuration database PostgreSQL, and the locale entry can be selected in the drop-down list (chinese,people ' s Republic of China) for the local area Addresses (connection license) optional or optional; the encoding item is UTF-8 encoded (key) in the drop-down list, Superuser name represents the user name of PostgreSQL, can be changed by itself, or it can be changed by default (suggest changing to your favorite name) Password Enter PostgreSQL required password (cannot be empty, must be more than four); Password (again) Confirm your password, (the super account established here is the database administrator user, note the difference with the previous service account.) Note that this dialog box only appears if you chose to have PostgreSQL run as a system service in the previous step.
|
Initializing Database Settings |
When you click Next, a remote connection option pops up, prompting the local connection database to be accepted by default, but if you want the remote computer to be able to connect to the database, you will need to set the pg_hba.conf file separately after the installation is complete, which we will explain later.
Select the process language that was activated in the test database template1 created by default, Pl/perl need ActiveState Perl 5.8 installation support, Pl/python Python 2.3 support, I only chose pgsql here. Note that this dialog box only appears if you have chosen to have PostgreSQL run as a system service, and you have chosen to initialize the database components.
|
Select a Process language |
Select the module that is activated in the test database template1, all the extension files will be installed, this step just choose which modules are activated by default in all of your databases. These extensions can provide some enhanced functionality.
|
Select Load Extension Module |
OK, at this point the installation configuration parameters have been completed, you just need to wait for the next installation to complete, PostgreSQL installation speed is very fast, depending on the machine at different times slightly different. Finally, the installation Success screen appears.
After restarting, we found that the PostgreSQL 8.1 program group was more in the Start menu program, and there were several more processes in the task manager, such as.
|
Post-installation Program menu |
|
Post-installation process |
Client connection Settings
Postgresql for security reasons, the default is to deny all remote client connections, if you want to telnet to the server side, you need to set pg_hba.conf, from the Start menu--Program-->postgresql 8.1--> In configuration files, select Edit Pg_hba.conf.
Modified to read as follows: # IPV4 local connections:host All 127.0.0.1/32 MD5 host all All 192.168.9.226/32 MD5
This means that the machine and 192.168.9.226 can connect to the database via a MD5 encrypted password. You can also allow the address of a segment to connect to the server by modifying the mask for the IP address. In addition, the authentication mode MD5 can also be changed to trust, which means that the connection of fully trusting this address (this is more convenient when debugging the program). Change to password, which means the connection is through a password, but the password is sent in clear text. After Setup is complete, you will need to restart PostgreSQL to take effect.
Client Connection Test
With the installation and setup above, one of the simplest PostgreSQL database servers has been set up, so let's look at how we can accomplish the following tasks on this database server: 1. Create a new database, delete it, 2. Create a new, delete a table.
There are two ways to access the operational database through the installation process above. Through the Psql to Postgres mode from the Start menu--Program-->postgresql 8.1-->psql to Postgres, enter the password for the super user specified during installation, such as
After entering the password, enter the command line interface
Enter the CREATE database mydb; mydb; Delete the unwanted database mydb through the drop DB mydb;
By creating Table MYFIRSTTB (Firstcol integer,secondcol text), create a Tables MYFIRSTTB by dropping table MYFIRSTTB;
For more commands, go to http://www.pgsqldb.org to inquire about the relevant documents. Use the graphical tools pgadmin to manage the database from Start menu to program-->postgresql 8.1-->pgadmin III, as
Right click on PostgreSQL Database Server 8.1 (localhost:5432), click Connect (connect), because I set the local area Connection in pg_hba.conf also through the password, pop up the following dialog box.
|
Enter password for Super User window |
Enter the super User password and enter the GUI management interface
|
Graphical Management interface |
Here you can easily and intuitively manage the database, specifically I will not say more. In addition, some other image management tools can also be used to manage the PostgreSQL database, for example, managed by EMS PostgreSQL Manager (http://www.sqlmanager.net/en/).
From the installation process, the installation of PostgreSQL on Windows is a very simple thing, instant as the author as a novice can be installed according to the wizard, you can install without administrative privileges. Because this is a version of PostgreSQL that supports Windows (no cygwin), PostgreSQL is installed as a service and can start without problems after the machine restarts.
The minimum resource requirements for PostgreSQL are very low. For example, when connecting remotely, open the Web browser and Ms-word, you can see that there is no impact on the test machine.
When it comes to the shortcomings, because users using PostgreSQL are not as extensive as users of MySQL, the online forum is not very active and an obstacle to getting started. I believe this will gradually improve.
"Reprint" Windows PostgreSQL installation diagram