Обсуждение: Questions: How to configure PostgreSQL at the beginning ....
Dear Sir or Madam, I have downloaded and installed the latest PostgreSQL version V9.2 to my Windows 7 OS PC. I want to have it running on my PC, as local host. Now I am facing some problems. 1.) I do not know, how to fill in the properties tab for the server, as name, host (what shall be host, shall I put there localhost or 127.0.0.1?), service field, Maintenance DB field (can it be named as postgres?)? And, what shall I put as user name? And password? Is there something predefined? Or how and where shall I change it? In which conf file? It does not accept what I add there .... I want to have it as simple as possible, I want to connect my PHP scripts with the PostgreSQL DB on my PC. 2.) Via the psql console, I can not login myself .... I want to create tables etc., but I need to overcome the connection and login procedure and again, I do not know what to put there, as it does not accept what I enter there ... Server [localhost]: What to put here? Database [postgres]: What to put here? Port [5432]: What to put here? Username [postgres]: What to put here? Password: What to put here? The message returned is for example this: psql: could not translate host name "Tomas" to address: Unknown server error Press any key to continue ... 3.) There are also some .conf files, like postgresql.conf, pg_hba.conf, pgpass.conf. What shall I put there? I played with that, but it does not work, I want to have it simple. Do you have any examples of configuration, what shall I put everywhere, so that it works? Thank you very much in advance Best regards Tomas
On Tuesday, February 19, 2013 4:37 PM Tomas Pasterak wrote: > I have downloaded and installed the latest PostgreSQL version V9.2 to = my Windows 7 OS PC. > I want to have it running on my PC, as local host. > Now I am facing some problems. > 1.) I do not know, how to fill in the properties tab for the server, = as name, host (what shall be host, shall=A0 > I put there localhost or 127.0.0.1?), service field, Maintenance DB = field (can it be named as postgres?)? > And, what shall I put as user name? And password? Is there something predefined? Or how and where shall I change it?=A0 > In which conf file?=A0 > It does not accept what I add there .... > I want to have it as simple as possible, I want to connect my PHP = scripts with the PostgreSQL DB on my PC. > 2.) Via the psql console, I can not login myself .... I want to create tables etc., but I need to overcome the=20 > connection and=A0 > login procedure and again, I do not know what to put there, as it does = not accept what I enter there ... > Server [localhost]: What to put here? > Database [postgres]: What to put here? > Port [5432]: What to put here? > Username [postgres]: What to put here? > Password: What to put here? > The message returned is for example this:=A0 > psql: could not translate host name "Tomas" to address: Unknown server error > Press any key to continue ... Have your psql.exe -d postgres? If your server is started with default configuration it should work. > 3.) There are also some .conf files, like postgresql.conf, = pg_hba.conf, pgpass.conf. What shall I put there? > I played with that, but it does not work, I want to have it simple. You don't need to change there unless you want something specific.=20 After initdb, the server should start with Pg_ctl.exe start -D data_dir Where data_dir is the path where you have created your database. With Regards, Amit Kapila.
On 02/19/2013 03:07 AM, Tomas Pasterak wrote: > Dear Sir or Madam, > > I have downloaded and installed the latest PostgreSQL version V9.2 to my > Windows 7 OS PC. > I want to have it running on my PC, as local host. > > Now I am facing some problems. > > 1.) I do not know, how to fill in the properties tab for the server, as > name, host (what shall be host, shall > I put there localhost or 127.0.0.1?), service field, Maintenance DB > field (can it be named as postgres?)? > And, what shall I put as user name? And password? Is there something > predefined? Or how and where shall I change it? > In which conf file? > It does not accept what I add there .... Are you creating a new database or trying to change an existing one? By default there should be postgres user set up with a password you supplied during the install. If you want more users then you will need to create them. Know that in Postgres users/groups are called roles, where a role with login privileges ~ user and one without ~ group. So in PgAdmin you would go Edit -> New Object -> New Login Role > > I want to have it as simple as possible, I want to connect my PHP > scripts with the PostgreSQL DB on my PC. > > > 2.) Via the psql console, I can not login myself .... I want to create > tables etc., but I need to overcome the connection and > login procedure and again, I do not know what to put there, as it does > not accept what I enter there ... > > Server [localhost]: What to put here? > Database [postgres]: What to put here? > Port [5432]: What to put here? > Username [postgres]: What to put here? > Password: What to put here? You should just accept the defaults[values in brackets] and supply the password you created for the postgres user on install. At that point you will be connected to the postgres database. On install Postgres create three system databases template0, template1 and postgres. At this point should not be dealing with the template* databases. The postgres(Maintenance DB) is basically empty and used primarily as a database to connect to and then do other things. One of those things would be to create your own database(s). You can do that using psql or PgAdmin. In PgAdmin that would happen under File -> Add Server. > > The message returned is for example this: > psql: could not translate host name "Tomas" to address: Unknown server error > Press any key to continue ... Looks like you tried to use your name as the host name. > > 3.) There are also some .conf files, like postgresql.conf, pg_hba.conf, > pgpass.conf. What shall I put there? > I played with that, but it does not work, I want to have it simple. > > Do you have any examples of configuration, what shall I put everywhere, > so that it works? That is big topic: http://www.postgresql.org/docs/9.2/interactive/runtime-config.html http://www.postgresql.org/docs/9.2/interactive/client-authentication.html For know I would tend to leave the settings alone, except for those in pg_hba.conf which are explained in the second link above. > > Thank you very much in advance > Best regards > Tomas -- Adrian Klaver adrian.klaver@gmail.com