i have installed postgres two days ago , since then i havent been able to even start the Database server despite having browse the whole internet , but all in vain .
when i start ubuntu , i login as 'abhishek' & pwd is "abhi" .
I read that , i have to create a new postgres user account "adduser " command . so i did :
sudo adduser postgres # (postgres is the name of account)
password : <gave the password as 'postgrespwd'>
then , i login as 'postgres' using command :
su postgres
password : 'postgrespwd'
then , usung 'initdb' , i initialsed the database cluser . Cluster got created successfully .
initdb -D data
then , when i get to start the DB server (as per the tutorials) , i typed the command :
./postgres -D data
but it says the error :
data has wrong ownership
HINT: The server must be started by the user that owns the data directory.
i saw that 'data' directory has the owner as root by looking into at its properties . Since i created the directory through initdb command after login into 'postgres' account , then why its owner is 'root' .
what should i do ??? please help, if you dont want me to switch back to Windows which i startd dislike after working on ubuntu !!
my whole attempt is here :
abhishek@ubuntu:/host/driveD/manualInstalls/SpatialDatabase/PostgreSQL_postGIS/installPostgreSQL/bin$ su postgres
Password:
postgres@ubuntu:/host/driveD/manualInstalls/SpatialDatabase/PostgreSQL_postGIS/installPostgreSQL/bin$ rm -r ./../mydata
postgres@ubuntu:/host/driveD/manualInstalls/SpatialDatabase/PostgreSQL_postGIS/installPostgreSQL/bin$ initdb -D ./../mydata
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_US.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to "english".
creating directory ./../mydata ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 28MB
creating configuration files ... ok
creating template1 database in ./../mydata/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... 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:
postgres -D ./../mydata
or
pg_ctl -D ./../mydata -l logfile start
postgres@ubuntu:/host/driveD/manualInstalls/SpatialDatabase/PostgreSQL_postGIS/installPostgreSQL/bin$ pg_ctl -D ./../mydata startserver starting
postgres@ubuntu:/host/driveD/manualInstalls/SpatialDatabase/PostgreSQL_postGIS/installPostgreSQL/bin$ FATAL: data directory "/host/driveD/manualInstalls/SpatialDatabase/PostgreSQL_postGIS/installPostgreSQL/bin/./../mydata" has wrong ownership
HINT: The server must be started by the user that owns the data directory.
postgres@ubuntu:/host/driveD/manualInstalls/SpatialDatabase/PostgreSQL_postGIS/installPostgreSQL/bin$ chown -R postgres ./../mydata
postgres@ubuntu:/host/driveD/manualInstalls/SpatialDatabase/PostgreSQL_postGIS/installPostgreSQL/bin$ pg_ctl -D ./../mydata startserver starting
postgres@ubuntu:/host/driveD/manualInstalls/SpatialDatabase/PostgreSQL_postGIS/installPostgreSQL/bin$ FATAL: data directory "/host/driveD/manualInstalls/SpatialDatabase/PostgreSQL_postGIS/installPostgreSQL/bin/./../mydata" has wrong ownership
HINT: The server must be started by the user that owns the data directory.
please help !!