怎么会这样?现在使用起来一切正常。
$ brew services start postgresql
Service `postgresql` already started, use `brew services restart postgresql` to restart.
$ 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"?
如何解决这个问题?
Version psql (PostgreSQL) 11.1
答案1
有没有可能你之前已经安装了 PostgreSQL 并且在brew中出现了更新的版本,所以postgresql升级到了更新的版本?
如果这是您的情况,您的数据文件与较新版本的 postgresql 不兼容,并且需要升级数据库。即使不需要,运行它也应该是安全的。
PostgreSQL 安装后消息:
==> 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```