Windows PostgreSQL installation Diagram _postgresql

Source: Internet
Author: User
Tags md5 postgresql psql create database postgresql version

Now talk about the free database, most people think first of all may be MySQL, indeed MySQL has been used in many areas of the country, especially the site erection. But, in fact, the most powerful, most feature-rich and complex free database should be PostgreSQL. Many of its features are the predecessor of today's many business databases, such as Oracle, DB2, and so on.

In fact, the author is also recently because of the needs of the project, contact a little PostgreSQL fur, recently PostgreSQL released a 8.1 version, the author of the network with the experience of your master to talk about a little of their own installation experience, and just began to contact PostgreSQL Novice friends to learn together.

Windows has been officially supported since PostgreSQL 8.0, and before that, if you want to install PostgreSQL on Windows, use tools such as Cygwin to simulate UNIX environments, Therefore, both stability and performance are lower than the installed version on Linux. Cut the crap and let's get to the point.

Download PostgreSQL for Windows

Login http://www.postgresql.org/ftp/, download the latest version, support multi-language installation.

Start installation

After downloading the installation files to the local, first use the decompression tool to untie the compressed package, and then, like installing other Windows applications, double-click Postgresql-8.1.msi to start the Installation wizard.

The first is to select the language used in the installation process, the author found one side did not find Chinese, had to choose to understand English ^_^. Alternatively, you can select the bottom option to write the detailed installation log to the current installation directory for troubleshooting the installation, or to read about the installation process.

Choose the installation language


The next step is to select the installation content options, which are divided into four parts, the database server side, user interface, database drive and development module. You can choose to install as needed. In order to understand more things, the author of the four part of the full load. Also note here is that the data directory options can only be installed in the NTFS-formatted partition, if you want to install in other format partitions, you need to install the Initdb.exe after the manual operation.

Select installation Option 1

  

Select installation Option 2


Tip: If you like to use graphical interface to manage the operation of the database, in the user interface can choose to install PGADMINIII.

Next is the service configuration, which you can run as a system service for Windows, which is one embodiment of the PostgreSQL starting to really support Windows installation (pictured below).

Select Install as Service
 
This sets the service name and the Windows account that is running the service. You can enter an existing account, or you can enter an account that does not currently exist, allowing the installer to set up this account automatically. The account Domain entry represents the full computer name on your computer, which can be--> to the "My Computer"--> the computer name, where there is a full computer name (as on my machine: cao-393d0fd737d), copy it, The last point of the name should not also be copied, pasted into the account Domain entry (note that you can only use the Fast intercept key Ctrl + V to paste).
Create an account automatically

When you create an account, you configure the database's listening port, connection license, and local area and superuser settings. Note that port number represents the listening port for the metabase PostgreSQL; locale items can be selected in the Drop-down list (Chinese,people ' Republic of ") represents the local area Addresses (connection license) optional or optional; encoding items are UTF-8 encoded (critical) in the Drop-down list, Superuser name is the username for PostgreSQL, you can change it yourself, or you can default (it is recommended to change your favorite name). Password Enter the PostgreSQL required password (cannot be empty, must be more than four); Password (again) Confirm your password, (the Super account set up here is the database administrator user, note the difference with the previous service account number.) Note that this dialog box only appears when you have selected the previous step to run PostgreSQL as a system service.
Initializing Database Settings

Click Next, will pop up a remote connection option, prompts the local connection database can be accepted by default, but if you want remote computers to be able to connect to the database, you need to set up after the installation of the pg_hba.conf file, the specific settings we explained later.

Select the process language that is activated in the default test database template1, Pl/perl need activestate Perl 5.8 installation support, Pl/python Python 2.3 support, I only chose pgsql here. Note that this dialog is only available if you have chosen to run PostgreSQL as a system service and have chosen to initialize the database components.

Select a Process language


Select the modules that are activated in the test database template1, and all extension files will be installed, and this step is simply choosing which modules to activate by default in all of your databases. These extension modules provide some enhanced functionality.

Select Load Extension Module


OK, the installation configuration parameters have been completed, you need only the next step to wait for the installation to complete, PostgreSQL installation speed, according to the machine different time slightly different. Finally, the installation successful interface appears.

Start installation

  

Installation End Interface
After restarting, found in the Start menu program more than PostgreSQL 8.1 of the program group, and in the task manager a few more processes, the following figure.
Post-installer Menu

Post-installation process
Client Connection Settings

Postgresql for security reasons, the default is to deny connections to all remote clients, and if you want to remotely log on to the server, you need to set up pg_hba.conf, from the Start menu--> program-->postgresql 8.1--> Select Edit pg_hba.conf in configuration files.

Edit pg_hba.conf

Modified to read as follows:
# IPV4 Local connections:
Host All 127.0.0.1/32 MD5
Host All 192.168.9.226/32 MD5

This means that this machine and 192.168.9.226 can connect to the database through a MD5 encrypted password. By modifying the mask of an IP address, you can also allow the address of which segment to connect to the server. In addition, authentication mode MD5 can also be changed to trust, which means that the connection of the address is fully trusted (this point is more convenient when debugging the program). Change to password, which means that the password is connected, but the password is sent in plaintext. When you are finished setting up, you 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 see how we can accomplish the following tasks on this database server: 1. New, delete a database; 2. New, delete a table.

There are two ways to access the operations database through the installation process above.
Through Psql to Postgres way
From the Start menu--> program-->postgresql 8.1-->psql to Postgres, enter the password for the superuser you specified at installation, as shown below

Enter password


After entering the password, enter the command line interface

Psql Operation Interface


Enter the CREATE database mydb; mydb; Delete unwanted database mydb through drop database mydb;

Through the CREATE TABLE MYFIRSTTB (firstcol integer,secondcol text), create a table MYFIRSTTB through the drop table MYFIRSTTB, and delete the table MYFIRSTTB.

More commands please go to http://www.pgsqldb.org to inquire about the relevant documents.
Managing databases with graphical tools Pgadmin
From the Start menu--> program-->postgresql 8.1-->pgadmin III, as shown below

Graphical interface


Right-click PostgreSQL Database Server 8.1 (localhost:5432), click Connect, because I set up the local connection in pg_hba.conf also through the password, pop-up the following dialog box.

Enter Password window for super user


Enter Superuser password and enter the graphical admin interface

Graphical Management interface


Here you can easily intuitive management of the database, specifically I do not say more.
Other graphical management tools also allow you to manage operations PostgreSQL databases, such as management with EMS PostgreSQL Manager (http://www.sqlmanager.net/en/).

Installing PostgreSQL on Windows is already a simple thing to do from the installation process, and it's just like the writer. Beginners can also be installed successfully according to the wizard, you can install without administrative privileges. Because this is a PostgreSQL version that supports Windows (without Cygwin), PostgreSQL is installed as a service and can be started without problems after the machine restarts.

The minimum resource requirements for PostgreSQL are very low. For example, when connecting remotely, opening a Web browser and Ms-word, you can see that there is no impact on the test machine.

When it comes to inadequacies, because users who use PostgreSQL are not as widely used as users of MySQL, the forum for online communication is not very active, and getting started with beginners is an obstacle. It is believed that this will gradually improve.

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.