Postgres,pg_dump版本不匹配

时间:2017-02-13 19:29:37

标签: postgresql

这可能是什么原因?请参阅以下错误。

pg_dump: server version: 9.6.1; pg_dump version: 9.5.5
pg_dump: aborting because of server version mismatch

然而,当我调查时:

peter@Peters-MacBook-Pro:~$ psql --version
psql (PostgreSQL) 9.6.1
peter@Peters-MacBook-Pro:~$ pg_dump --version
pg_dump (PostgreSQL) 9.6.1

两个版本相同。

其他命令:

peter@Peters-MacBook-Pro:~$ find / -name pg_dump -type f 2>/dev/null
/Applications/pgAdmin3.app/Contents/SharedSupport/pg_dump
/Applications/Postgres-9.6.1.0-2.app/Contents/Versions/9.6/bin/pg_dump
/Applications/Postgres-9.6.1.0.app/Contents/Versions/9.6/bin/pg_dump
/Applications/Postgres.app/Contents/Versions/9.6/bin/pg_dump

peter@Peters-MacBook-Pro:~$ which postgres
/Applications/Postgres.app/Contents/Versions/latest/bin/postgres

peter@Peters-MacBook-Pro:~$ which pg_dump
/Applications/Postgres.app/Contents/Versions/latest/bin/pg_dump

1 个答案:

答案 0 :(得分:0)

回答就是跑:

/Applications/Postgres.app/Contents/Versions/latest/bin/pg_dump db_name > db.out

使用的路径来自于查看结果:

which postgres
>/Applications/Postgres.app/Contents/Versions/latest/bin/postgres

然后我就能运行正确的版本pg_dump