在我做了brew更新和brew升级之后,我的postgres遇到了一些问题.我试图卸载postgres并重新安装,但它也没有用.
这是错误消息.(当我尝试执行rake db:migrate时,我也收到此错误消息)
$ psql
psql: 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"?
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
Mac版:山狮.
自制版:0.9.3
postgres版本:psql(PostgreSQL)9.2.1
这就是我所做的.
12:30 ~/D/works$ brew uninstall postgresql
Uninstalling /usr/local/Cellar/postgresql/9.2.1...
12:31 ~/D/works$ brew uninstall postgresql
Uninstalling /usr/local/Cellar/postgresql/9.1.4...
12:31 ~/D/works$ psql --version
bash: /usr/local/bin/psql: No such file or directory
12:33 ~/D/works$ brew install postgresql
==> Downloading http://ftp.postgresql.org/pub/source/v9.2.1/postgresql-9.2.1.tar.bz2
Already downloaded: /Library/Caches/Homebrew/postgresql-9.2.1.tar.bz2
......
......
==> Summary
/usr/local/Cellar/postgresql/9.2.1: 2814 files, 38M, built in …Run Code Online (Sandbox Code Playgroud) 重新启动MacBook Pro后,我无法启动数据库服务器:
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"?
Run Code Online (Sandbox Code Playgroud)
我检查了日志,然后一遍又一遍地出现以下行:
FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.2, which is not compatible with this version 9.0.4.
Run Code Online (Sandbox Code Playgroud)
9.0.4是预装在mac上的版本,9.2 [.4]是我通过Homebrew安装的版本.如前所述,这曾经在重启之前工作,所以它实际上不是一个编译问题.我也重新运行initdb /usr/local/var/postgres -E utf8,文件仍然存在.
不幸的是,我对Postgres很新,所以任何帮助都会非常感激.