Unix Technical Forum

Re: Problem. createdb: could not connect to database postgres: could not connect to server: No such file or directory

This is a discussion on Re: Problem. createdb: could not connect to database postgres: could not connect to server: No such file or directory within the Pgsql General forums, part of the PostgreSQL category; --> 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 ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-15-2008, 09:33 PM
Alban Hertroys
 
Posts: n/a
Default Re: Problem. createdb: could not connect to database postgres: could not connect to server: No such file or directory

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!



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:04 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com