I keep getting this error when i try to run my localhost using \"$rails s\":
(Mac OSX 10.8.3) (ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.3.0]) (R
The error message is instrumental:
could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5433?
You may be trying to connect to the wrong port.
Standard port is 5432. Check how (and whether at all) you started your postgres server:
postgres@db:~$ ps -auxww | grep ^postgres
...
postgres 1274 0.0 0.3 1437240 57308 ? S May27 5:01 /usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf
The manual has related information here.
In my example, settings from /etc/postgresql/9.1/main/postgresql.conf got used, which says (among many other settings):
port = 5432
Or run:
netstat -nlp | grep postgres
Or just look here (at least in Debian or Ubuntu):
ls -lA /var/run/postgresql/
PostgreSQL picks the next free port if you create a new database cluster. Since you installed repeatedly, you may have confused port numbers.
Or you just forgot to allow TCP/IP connections. Related answers: