在brew更新之后修复HomeBrew的邮戳;在OSX 10上

时间:2019-03-25 13:26:24

标签: postgresql homebrew

重新启动后,尝试通过Rails或通过终端输入psql来使用Postgres时遇到错误

  

没有这样的文件或目录服务器是否在本地运行并接受   Unix域套接字“ /tmp/.s.PGSQL.5432”上是否连接?

我用自制软件安装了postgres。

我已经运行了这些诊断程序,但是不了解输出:

> brew list|grep postgres         
postgresql
postgresql@10

> brew services restart postgresql
Stopping `postgresql`... (might take a while)
==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)

❯ pg_ctl -D /usr/local/var/postgres status
pg_ctl: no server running

❯ brew info postgresql                      
postgresql: stable 11.2 (bottled), HEAD
Object-relational database system
https://www.postgresql.org/
Conflicts with:
  postgres-xc (because postgresql and postgres-xc install the same binaries.)
/usr/local/Cellar/postgresql/11.2 (3,186 files, 35.4MB) *
  Poured from bottle on 2019-03-20 at 12:42:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/postgresql.rb
==> Dependencies
Build: pkg-config ✔
Required: icu4c ✔, openssl ✔, readline ✔
==> Options
--HEAD
    Install HEAD version
==> Caveats
To migrate existing data from a previous major version of PostgreSQL run:
  brew postgresql-upgrade-database

To have launchd start postgresql now and restart at login:
  brew services start postgresql
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgres start
==> Analytics
install: 84,642 (30 days), 236,127 (90 days), 754,771 (365 days)
install_on_request: 75,641 (30 days), 208,395 (90 days), 652,972 (365 days)
build_error: 0 (30 days)

> ps auxwww | grep postgres                    
will             19993   0.0  0.0  4284404    804 s001  S+    1:22pm   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn postgres

 ❯ ps -ef | grep postgres                                                                                                                                                                        
  502 20156  4003   0  1:24pm ttys001    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn postgres

> psql --version
psql (PostgreSQL) 11.2
> pg_upgrade --version
pg_upgrade (PostgreSQL) 11.2

尝试的解决方案:

❯ rm /usr/local/var/postgres/postmaster.pid
rm: /usr/local/var/postgres/postmaster.pid: No such file or directory

> initdb /usr/local/var/postgres -E utf8
initdb: directory "/usr/local/var/postgres" exists but is not empty

上面的一些调试资料引用了postgres 10,有些引用了11。我是否以某种方式不小心安装了2个postgres?我该如何解决?

0 个答案:

没有答案