【发布时间】:2016-04-05 03:28:09
【问题描述】:
我正在尝试使用 PostgreSQL 作为数据库启动一个 Ruby on Rails 应用程序,因为一旦这个站点完成,我将把它推广到另一个拥有 259K 关注者的博客,我只想预测我的用户群是否新网站变大了。
不管怎样,我首先遵循了这个教程:https://gorails.com/setup/osx/10.11-el-capitan。但是当我使用 PostgreSQL 制作我的应用程序时,数据库将无法创建。
所以我退后一步,尝试卸载并重新安装 postgres,我更新了我的自制软件,现在我正在关注这个新教程: https://www.codefellows.org/blog/three-battle-tested-ways-to-install-postgresql#macosx
我正在执行以下步骤:根据您的用户名创建默认数据库。
我运行命令并得到这个:
Mayas-MacBook-Air:~ mayaah$ which psql
/usr/local/bin/psql
Mayas-MacBook-Air:~ mayaah$ createdb `whoami`
createdb: could not connect to database template1: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
我不知道从这里做什么。我已经广泛搜索了这个问题,但找不到答案。我能想到的唯一可能的问题是我的 Mac 剩下的空间很少,因为我看到了一些我不太了解的“共享空间”。
对此的任何见解,尤其是具体的分步命令行说明都会非常有帮助。谢谢!
编辑: 现在我找到了这个教程:http://exponential.io/blog/2015/02/21/install-postgresql-on-mac-os-x-via-brew/
试图运行
postgres -D /usr/local/var/postgres
知道了:
LOG: skipping missing configuration file "/usr/local/var/postgres/postgresql.auto.conf"
FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.3, which is not compatible with this version 9.4.5.
我也不知道从这里做什么。
【问题讨论】:
-
似乎 Postgres 没有运行。您是否完成了之前的所有步骤?尝试运行
ps aux | grep postgres看看是否有问题。 -
我运行它并得到:
mayaah 1302 0.0 0.0 2423376 296 s000 R+ 9:55PM 0:00.00 grep postgres我不知道如何解释这个
标签: ruby-on-rails ruby macos postgresql