I\'m having an issue with my install of postgres in my development environment and I need some help diagnosing it. I haven\'t yet had any luck in tracking down a solution.
I agree about all of the above solutions. I was running Postgres on a server, and the problem was that I was using a PORT number that was used by some other OLDER version of Postgres.
I only needed to change the port.
This (https://gist.github.com/olivierlacan/e1bf5c34bc9f82e06bc0) solved my problem! I first had to:
initdb /usr/local/var/postgres/
Then I was able to start/stop Postgres with these 2 commands:
Start:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Stop:
pg_ctl -D /usr/local/var/postgres stop -s -m fast
I had the same error psql: FATAL: could not open relation mapping file "global/pg_filenode.map": No such file or directory
.
Thanks for note #2 above: 'Kill the processes for 9.0.3'
I previously configured and compiled PostgreSQL. I then decided to reconfigure, gmake, gmake install with different file paths. The newly compiled program wasn't finding 'pg_filenode.map' in the expected filepath. Killing the running postgres process, emptying pgsql/data, and doing initdb again allowed creation of a new database.
That may be a permission issue, Please check the owner and group of configuration files in /var/lib/pgsql/9.3/data/
chown -R postgres:postgres /var/lib/pgsql/9.3/data/
solved the issue for me
My step-by-step solution in fedora:
/bin/systemctl stop postgresql.service
(Stop the service)rm -rf /var/lib/pgsql/data
(Remove the "data" direcotry)postgresql-setup initdb
(Recreate the "data" directory)/bin/systemctl start postgresql.service
(Start the service)It is also useful to check the permissions of the "data" directory:
chown -R postgres:postgres <path_to_data_dir>
(Kudos to @LuizFernandodaSilva & @user4640867)
Encountered this problem using mdillon/postgis:9.6
Docker image. Simple sudo docker restart <container id>
solved the problem.