Could not connect to postgres after installing 9.4 and uninstalling 9.3 I have installed postgresql 9.4 and I removed postgresql 9.3 from my computer. Now when I try to run:

foo@bar:~$ psql


I get the error 

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.5432"?


Note:

foo@bar:~$ psql --version
psql (PostgreSQL) 9.4.2
I resolve the problem changin the port from 5433 to 5432