Re: getting started with psql

From: Michael Wood <esiotrot(at)gmail(dot)com>
To: Eric Hulburd <ehulburd(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: getting started with psql
Date: 2011-09-06 08:10:17
Message-ID: CAP6d-HWmG3SpaYBNJ_j2yC=pf1hnU6uVrKc5uqXuFdQxuqen7w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi

On 6 September 2011 03:05, Eric Hulburd <ehulburd(at)gmail(dot)com> wrote:
> Hi,
> I have little programming experience and I've been trying to go through the
> PostgreSQL 9.0.4 documentation tutorial.  I got to section about creating  a
> new database and was lost.

> On opening psql,  get the following prompts:
> Server [localhost]:
> Database [postgres]:
> Port [5432]:
> Username [postgres]:
> Password for user username:

> I have no idea what I should be entering here.  I'm not trying to connect to
> any other server.  I'm just trying to create a database for others to
> connect to.  What do I enter for Port?  I don't remember signing up for any
> username.  Where do I find my username?

> Thanks,
> Eric

OK, there's something you need to understand about how PostgreSQL
works. It runs as a server and whatever you need to do with it (e.g.
creating a new database) requires connecting to it from a client. The
"psql" tool is a client that connects to the database server. Often
on the same machine, but not necessarily.

If you're on the same machine as the PostgreSQL server (which it seems
like you are), "localhost" is the right answer for the hostname. (If
you're on Linux/UNIX it would not necessarily be the best option, but
I am guessing you're on Windows.) So you should just be able to press
Enter, since the default (shown in square brackets) will be used if
you just press Enter.

The default port for PostgreSQL is 5432 (as you can see in the square
brackets) and that is most likely the correct option. You would
probably know if you had changed it.

The database to connect to depends on the installer to some extent.
Some installers will (I believe) create a database called "postgres"
automatically. So you could try that. If that fails, you could use
"template1" instead, which is a database that's included by default.
template1 is used as a template for creating new databases, so
normally you should not do anything with it directly, but if there are
no other databases yet, you can connect to template1 in order to
create new databases. This is because in order to connect to the
PostgreSQL server, you always need to specify an existing database to
connect to.

The usual username for managing PostgreSQL is "postgres". Depending
on the installation progress, you might have had to specify the
password when it was installing, or else you might not need to specify
a password.

By the way, if you're unfamiliar with using the command line, one of
the GUI administration tools might be easier for you. I have not used
them, but other people on this list should be able to help with them
if necessary.

--
Michael Wood <esiotrot(at)gmail(dot)com>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Dan Hajduk 2011-09-06 14:40:59 Warning in log file
Previous Message Jayadevan M 2011-09-06 03:09:35 Re: getting started with psql