There seems to be lots of questions likes this on stackoverflow, but none of them seemed to help me. I am runing Ubuntu on my windows linux subsystem and trying to install and use postgresql.
I installed in like this:
sudo apt-get install postgresql postgresql-contrib postgresql-client
pgadmin3
which worked fine:
near the bottom the install log says:
Creating new cluster 9.5/main ...
config /etc/postgresql/9.5/main
data /var/lib/postgresql/9.5/main
locale C
socket /var/run/postgresql
port 5433
update-alternatives: using /usr/share/postgresql/9.5/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
invoke-rc.d: could not determine current runlevel
Setting up postgresql (9.5+173) ...
Setting up postgresql-client (9.5+173) ...
Setting up postgresql-contrib-9.5 (9.5.8-0ubuntu0.16.04.1) ...
Setting up postgresql-contrib (9.5+173) ...
Processing triggers for systemd (229-4ubuntu16) ...
Processing triggers for ureadahead (0.100.0-19) ...
So the port is 5433. This is also the port listed in the postgresql.conf file.
When I type psql I get:
psql: 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.5433"?
When I do:
ps -df | grep postgres
I get a different port though (5432) and this is returned:
spotter 12 2 0 18:55 tty1 00:00:00 /usr/lib/postgresql/9.5/bin/psql -h 199.92.170.64 -d rtu_prod -Usv-read -p 5432
spotter 1835 2 0 20:21 tty1 00:00:00 grep --color=auto -a postgres
spotter 6134 2 0 20:51 tty1 00:00:00 grep --color=auto -a postgres
spotter 9348 2 0 22:06 tty1 00:00:00 grep --color=auto postgres
I think this might mean I have two versions of postgresql installed but I'm not sure.
Based on other posts I should enter /usr/lib/postgresql/9.5/bin/psql -h 199.92.170.64 -d rtu_prod -Usv-read -p 5432 to start it, but this asks for a password I have never heard of Password for user sv-read:
PostgreSQL works just fine with WSL. To fully run it, follow these steps:
Installation Steps:
sudo apt updatesudo apt install postgresql postgresql-contribsudo service postgresql startsudo -i -u postgrespsqlUser setup from psql:
CREATE USER <Your User name> WITH PASSWORD '<Your Password>';CREATE DATABASE <Your database> WITH OWNER <Your User name>;\password postgresIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With