Database Version: Postgresql 9.0.1
OS: Linux rumman.dhaka 2.6.18-92.el5xen #1 SMP Tue Jun 10 19:55:54 EDT 2008 i686 i686 i386 GNU/Linux
Installed from: Source configure
Problem:
When I try to connect to postgres, I got -
psql: FATAL: role "postgres" does not exist
In fact, it seems to me that no role exists.
Problem Cause:
For some reason, filesystem of my server was corrupted. Our system admin used CENTOS repair tools and it damaged the database files.
It created some of the directory as files. These are -
- pg_notify
- pg_xlog
Some files were not readable during start. These were - pg_internal and pg_control in the global directory.
At first, when I tried to start the server after CENTOS repair, I got the error message -
DETAIL: The database cluster was initialized with PG_CONTROL_VERSION 0, but the server was compiled with PG_CONTROL_VERSION 903.
I created a fresh cluster and copied the pg_control and pg_internal from this cluster to the corrupted cluster.
Then, I tried to start and I got
FATAL: could not open directory "pg_notify": Not a directory
This was created as files instead of directory. I removed it and created the directory.
At this point, the server started successfully.
Then I tried to connect using psql command.
But I got -
psql: FATAL: role "postgres" does not exist
I tried to use CRAETEUSER. But it can't connect to db.
Please help.