I followed this tutorial to install PG on my Mac. It's my first time using PG locally. I used Sqlite a lot in my Rails projects before this.
I found this PSequel GUI app and I just installed it. But I've no idea how to connect to my localhost PostgreSQL databases.
What is my:
localhost:3000
to test my Rails app locally)Thanks.
localhost:3000
is the default url of webrick webserver. By default postgre SQL service connection is to localhost
on 5432
post.
$ cat /etc/services | grep postgres
postgres 5432/tcp # POSTGRES
postgres 5432/udp # POSTGRES
That is for unix
like systems. And I have postgres
server listening on 5432
port.
$ netstat -l --numeric-ports |grep 5432
tcp 0 0 localhost.localdomain:5432 *:*
unix 2 [ ACC ] STREAM LISTENING 11396 /tmp/.s.PGSQL.5432
So the fields will have the following default values:
Host/Socket
localhost
For test/development purposes most people use local server to connect to db.
Port
5432
That is just postgres
server (not webserver) connection port. To validate just list and grep the postgres
configuration file, like follows:
# cat /var/lib/pgsql/data/postgresql.conf | grep port
#port = 5432 # (change requires restart)
Here it is commented out, so default values are applied.
User
you are, but you must create the user role before connection as of the postgres
user with createuser
or psql
terminal utilities.
Password
When you will create the user just leave password empty. So you be able then stay the field empty in the form.
Database
That is the database name. Create it with the command if needed.
If 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