Re: Problem. createdb: could not connect to database postgres: could not connect to server: No such file or directory - Mailing list pgsql-general

From Alban Hertroys
Subject Re: Problem. createdb: could not connect to database postgres: could not connect to server: No such file or directory
Date
Msg-id 0A43F1ED-8873-47B0-92BC-7E6CEFD65B6A@solfertje.student.utwente.nl
Whole thread Raw
In response to Problem. createdb: could not connect to database postgres: could not connect to server: No such file or directory  ("Jaisen N.D." <jaisuvyas@gmail.com>)
List pgsql-general
On Apr 12, 2008, at 7:11 AM, Jaisen N.D. wrote:
> localhost:/home/user# su - postgres
> postgres@localhost:~$ /usr/lib/postgresql/8.1/bin/initdb -D /var/
> lib/postgresql/data
> The files belonging to this database system will be owned by user
> "postgres".
> This user must also own the server process.
>
> The database cluster will be initialized with locale en_IN.
> The default database encoding has accordingly been set to UTF8.
>
> initdb: directory "/var/lib/postgresql/data" exists but is not empty
> If you want to create a new database system, either remove or empty
> the directory "/var/lib/postgresql/data" or run initdb
> with an argument other than "/var/lib/postgresql/data".

It says right here. You forgot to move your old data directory out of
the way. As it's from a Postgres 8.3 installation, Postgres 8.1 has
no way of knowing how to handle what's in there.

> postgres@localhost:~$ /usr/lib/postgresql/8.1/bin/pg_ctl -D /var/
> lib/postgresql/data -l logfile start
> postmaster starting
> postgres@localhost:~$ /usr/lib/postgresql/8.1/bin/createdb test
> createdb: could not connect to database postgres: could not connect
> to server: No such file or directory
>         Is the server running locally and accepting
>         connections on Unix domain socket "/var/run/
> postgresql/.s.PGSQL.5432"?
> postgres@localhost:~$
> -----------------------------------------------------
> Why it can't connect to server? How can I resolve it??


Because initialisation of the database (initdb) failed for the
aforementioned reason. There are probably some messages in your logs
about postgres failing to start or to operate on its data directory.
You can't just run a different major version of postgres on an
existing data directory.

You didn't tell what your goal is. Are you trying to downgrade an
existing database? If so, why would you want to do that?

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,48008eed927663372713408!



pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Problem. createdb: could not connect to database postgres: could not connect to server: No such file or directory
Next
From: "Chad Showalter"
Date:
Subject: rule to update view that inserts into log