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

From: "Jaisen N(dot)D(dot)" <jaisuvyas(at)gmail(dot)com>
To: "Craig Ringer" <craig(at)postnewspapers(dot)com(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem. createdb: could not connect to database postgres: could not connect to server: No such file or directory
Date: 2008-04-19 04:44:00
Message-ID: 7db916da0804182144u28abc117s93cac4fd0600cf1f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi., Sorry for my late reply, I wasn't on desk for last few days. My goal is
to set up a spatial database, with postgresql 8.1. I removed the postgresql
installation using apt-get --purge remove. and removed the
var/lib/postgresql/data directory. And then reinstalled it again. The result
I got is here:-
--------------------------
localhost:/home/user# apt-get install postgresql-8.1
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
postgresql-client-8.1
The following NEW packages will be installed:
postgresql-8.1 postgresql-client-8.1
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 0B/5711kB of archives.
After unpacking 15.1MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Selecting previously deselected package postgresql-client-8.1.
(Reading database ... 197573 files and directories currently installed.)
Unpacking postgresql-client-8.1 (from
.../postgresql-client-8.1_8.1.11-0etch1_i3
86.deb) ...
Selecting previously deselected package postgresql-8.1.
Unpacking postgresql-8.1 (from .../postgresql-8.1_8.1.11-0etch1_i386.deb)
...
Setting up postgresql-client-8.1 (8.1.11-0etch1) ...

Setting up postgresql-8.1 (8.1.11-0etch1) ...
Creating new cluster (configuration: /etc/postgresql/8.1/main, data:
/var/lib/po stgresql/8.1/main)...
Moving configuration file /var/lib/postgresql/8.1/main/postgresql.conf to
/etc/p ostgresql/8.1/main...
Moving configuration file /var/lib/postgresql/8.1/main/pg_hba.conf to
/etc/postg resql/8.1/main...
Moving configuration file /var/lib/postgresql/8.1/main/pg_ident.conf to
/etc/pos tgresql/8.1/main...
Warning: The socket directory for owners other than 'postgres'
defaults to /tmp. You might want to change the unix_socket_directory
parameter
in postgresql.conf to a more secure directory.
Configuring postgresql.conf to use port 5432...
Starting PostgreSQL 8.1 database server: main.

localhost:/home/user#
--------------------------------------
I created data folder again. But When I tried to create a test database, I
couldn't. Here is the steps I followed:-
--------------------------------------
localhost:/home/user# adduser postgres
adduser: The user `postgres' already exists.
localhost:/home/user# mkdir /var/lib/postgresql/data
localhost:/home/user# chown postgres /var/lib/postgresql/data
localhost:/home/user# su - postgres
postgres(at)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.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating directory /var/lib/postgresql/data/global ... ok
creating directory /var/lib/postgresql/data/pg_xlog ... ok
creating directory /var/lib/postgresql/data/pg_xlog/archive_status ... ok
creating directory /var/lib/postgresql/data/pg_clog ... ok
creating directory /var/lib/postgresql/data/pg_subtrans ... ok
creating directory /var/lib/postgresql/data/pg_twophase ... ok
creating directory /var/lib/postgresql/data/pg_multixact/members ... ok
creating directory /var/lib/postgresql/data/pg_multixact/offsets ... ok
creating directory /var/lib/postgresql/data/base ... ok
creating directory /var/lib/postgresql/data/base/1 ... ok
creating directory /var/lib/postgresql/data/pg_tblspc ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 1000
creating configuration files ... ok
creating template1 database in /var/lib/postgresql/data/base/1 ... ok
initializing pg_authid ... ok
enabling unlimited row size for system tables ... ok
initializing dependencies ... ok
creating system views ... ok
loading pg_description ... ok
creating conversions ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

/usr/lib/postgresql/8.1/bin/postmaster -D /var/lib/postgresql/data
or
/usr/lib/postgresql/8.1/bin/pg_ctl -D /var/lib/postgresql/data -l
logfile start

postgres(at)localhost:~$ /usr/lib/postgresql/8.1/bin/pg_ctl -D
/var/lib/postgresql/data -l logfile start
postmaster starting
postgres(at)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(at)localhost:~$
--------------------------------------
Where is the problem??
The logfile in home folder of postgres user is as follows:-
--------------------------------------
LOG: could not bind IPv4 socket: Address already in use
HINT: Is another postmaster already running on port 5432? If not, wait a
few seconds and retry.
WARNING: could not create listen socket for "localhost"
FATAL: could not create any TCP/IP sockets
----------------------------------------
How can I correct it??

--
(`'·.¸(`'·.¸ ¸.·'´) ¸.·'´)
«´¨`·*Jaisen.*..´¨`»
(¸.·'´(¸.·'´ `'·.¸)`'·.¸)
¸.·´
( `·.¸
`·.¸ )
¸.·)´
(.·´
( `v´ )
`v´

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Anton Andreev 2008-04-19 08:33:59 very slow updates in 8.3?
Previous Message BLazeD 2008-04-19 03:27:27 Changed Hosts, Lots of Errors in PostgreSQL - Help Please!