我跟着本教程 http://www.moncefbelyamani.com/how-to-install-postgresql-on-a-mac-with-homebrew-and-lunchy/在我的 Mac 上安装 PG。这是我第一次在本地使用PG。在此之前,我在 Rails 项目中大量使用了 Sqlite。
我找到了这个Psequel GUI 应用程序 http://www.psequel.com/我刚刚安装了它。但我不知道如何连接到我的本地主机 PostgreSQL 数据库。
我的是什么:
- 主机/套接字?
- 港口? (我用
localhost:3000
在本地测试我的 Rails 应用程序)
- User?
- 密码?
- 数据库?
Thanks.
localhost:3000
是默认网址webrick /questions/tagged/webrick网络服务器。默认情况下 postgreSQL 服务连接是localhost
on 5432
post.
$ cat /etc/services | grep postgres
postgres 5432/tcp # POSTGRES
postgres 5432/udp # POSTGRES
那是为了unix
像系统一样。我有postgres
服务器监听5432
port.
$ netstat -l --numeric-ports |grep 5432
tcp 0 0 localhost.localdomain:5432 *:*
unix 2 [ ACC ] STREAM LISTENING 11396 /tmp/.s.PGSQL.5432
因此这些字段将具有以下默认值:
-
主机/插座
localhost
出于测试/开发目的,大多数人使用本地服务器连接到数据库。
-
Port
5432
那只是postgres
服务器(不是网络服务器)连接端口。要验证只需列出并 greppostgres
配置文件,如下:
# cat /var/lib/pgsql/data/postgresql.conf | grep port
#port = 5432 # (change requires restart)
这里它被注释掉了,所以应用默认值。
-
User
你是,但你必须创建用户角色 http://www.postgresql.org/docs/9.2/static/app-createuser.html连接前截至postgres
用户与createuser
or psql
终端实用程序。
-
Password
当您创建用户时,只需将密码留空即可。这样您就可以将表单中的字段保留为空。
-
Database
那是数据库名称。Create http://www.postgresql.org/docs/9.1/static/manage-ag-createdb.html如果需要,可以使用命令。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)