每Postgresapp.com
psql是数据库的PostgreSQL命令行接口。MacOS10.7附带了一个较旧版本的PostgreSQL,可以通过以下命令启动该版本: $ psql -h本地主机
所以我运行psql -h localhost
Dans-MacBook-Pro:~ djechlin$ psql -h localhost
psql: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?据我所知,psql不过是一个客户端,Postgresapp.com的文档只是说说而已。我仍然不知道如何在本地启动postgres服务器,也没有找到任何相关文档。
版本:
Dans-MacBook-Pro:~ djechlin$ psql --version
psql (PostgreSQL) 9.1.5
contains support for command-line editing我用的是Mac 10.8.4。
发布于 2014-06-01 15:09:16
这显然比应该的更令人困惑,但是.
pg_ctl通常负责启动postgres服务器。OS X does not come bundled with it。如何运行它是explained in this pre-Postgres.app answer。发布于 2014-06-01 15:06:55
尝试更改为postgres用户并打开psql提示符
sudo -u postgres psql postgres在这里,您可以创建更多的角色、数据库等,并连接到您想要连接的任何东西上。
下面是我经常提到的一份有用的命令备忘单:
http://blog.jasonmeridth.com/posts/postgresql-command-line-cheat-sheet/https://stackoverflow.com/questions/23981034
复制相似问题