PostgreSQL installation under Windows platform

Source: Internet
Author: User
Tags command line connect postgresql postgresql commands psql
Window


after a day and night of torture, finally let PostgreSQL normal running on my computer, although some instability, but finally can be used, nonsense less said, the following is to say my configuration process:





1. To get the latest PostgreSQL for Windows version, I use 7.31 (* * *, this How the devil like the bacteria force? Overthrow the Japanese imperialists!!! ) to start the default installation. I don't know why this bird can not choose the installation path, maybe I did not find it? But I installed it more than 20 times and did not find, if the prawn found out, please let me know, ^O^. When the installation is complete, you will be prompted to restart your computer.





2. After reboot completes enters the command line mode, note, is not the Windows command line mode, but is the PostgreSQL commands the shell, everybody reader oneself to find it, if cannot find immediately to die, hehe.





3. After entering the command shell, you will find that your computer has become Unix, oh, don't be afraid, just a simulation of UNIX, because PostgreSQL is based on UNIX and Linux development, If you want to run under Windows, you need a virtual UNIX environment called Cygwin, but you can rest assured that this thing has been installed in your system as you install PostgreSQL, and you use the command shell.





4. First LS to see, LS is the dos in the Dir, of course, here Dir also easy to use, I was only to present pendulum just (to tell the truth, the other I will not, if you will also use Windows platform under the installation of this thing), if found no data directory, This means that your PostgreSQL did not install the default database, because I installed the system back and forth this thing, so I do not know when to install when there is no installation, hehe, this law to sum up. If there is no data directory, then you have to install the database, do not worry, this directory do not have to build, run initdb-d/data See, the system prompts a lot of OK after the database is built, but occasionally there will be errors, I think this is because of the operating system, After all, this thing is not specifically for Windows development, there is such a problem is normal.





5. The database is finished, what are we going to do next? Nonsense, of course, is to start the service. However PostgreSQL the service that is installed in the system by default I have never started up, the error message is not prompted. Just tell you there is an internal error, but what internal error is not known. Let me ask the manager. , I am the administrator, this computer is mine, I ask who, Bill? So after n attempts I made a wise and brilliant decision, that is, every time the installation is over PostgreSQL immediately turn that hateful system service off, in particular, Serviceremove.bat, let it go to hell, I would rather every time manually start the server, looking at the comfortable, have a sense of achievement!!! It's a little far away, don't throw the persimmon!!! pg_ctl-d/data-l Logfile start system, exciting moment is coming! Postmaster successfully started. Start successful, oh, you reader, if you start without success on their own to find out why it, anyway, I was the start of success. No more broken persimmon,!!!.





6. Run the psql quickly to see if you can connect to the database. Could not connect to Server:connection refused are the server running on host server.joe.com and accepting TCP/IP connecti ONS on port 5432? and accepting connections on Unix socket '/tmp/.s.pgsql.5432 '? Congratulations and a big step towards success. Stop the server first: Pg_ctl stop. Then open your/data directory and find postgresql.conf file that will tcpip_socket = true Max_connections = 2 Port = 543 2 before the # number removed, and then the first (Tcpip_socket) to True, save the exit, do remember to save it!!! Start the service again: pg_ctl-d/data-l logfile Start, then Psql, see Welcome to Psql 7.3.1, the PostgreSQL Interactive. Successful, now can be remote management operations, and quickly install a pgadminii, you can arbitrarily manage your database. I almost forgot to say that PostgreSQL is the name of the administrator you are currently installing the database as your database administrator, the password is the same, but to distinguish the case, be sure to pay attention to





OK, say here basically can end, if you install after PostgreSQL the system already exists the data directory, can skip Initdb command.





good luck to all of you. There are questions to continue the discussion ....





Copyright belongs to Ibeyond (http://www.ibeyond.org) all, reprint please famous source and retain copyright information.








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.