如何更正psql版本和postgresql版本的不匹配? [英] How do I correct the mismatch of psql version and postgresql version?

查看:748
本文介绍了如何更正psql版本和postgresql版本的不匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在某些地方,我最终在 postgresql-9.4 psql 之间的版本不匹配9.3(尽管已安装9.4版)。
我想我需要更正 $ PATH 变量,但是我不知道在哪里可以找到它。我查看了 /etc/.bashrc 文件,看不到任何指向正确方向的文件。

Somewhere along the line I have ended up with a version mismatch between postgresql-9.4 and psql which is version 9.3 despite the fact that version 9.4 is installed. I think I need to correct the $PATH variable but I don't know where to find this. I've looked in my /etc/.bashrc file and can't see anything that points me in the right direction.

当我执行 sudo find / -name psql 时,结果是:

/usr/bin/psql
/usr/share/bash-completion/completions/psql
/usr/pgsql-9.4/bin/psql

已安装yum列表| grep postgres 产生以下内容:

postgresql.x86_64                9.3.9-1.fc21                          @updates 
postgresql-contrib.x86_64        9.3.9-1.fc21                          @updates 
postgresql-devel.x86_64          9.3.9-1.fc21                          @updates 
postgresql-libs.x86_64           9.3.9-1.fc21                          @updates 
postgresql-server.x86_64         9.3.9-1.fc21                          @updates 
postgresql94.x86_64              9.4.5-1PGDG.f21                       @pgdg94  
postgresql94-libs.x86_64         9.4.5-1PGDG.f21                       @pgdg94  
postgresql94-server.x86_64       9.4.5-1PGDG.f21                       @pgdg94 


推荐答案

正如克雷格·林格(Craig Ringer)回答的-通常,您应该使用:

As Craig Ringer answered - generally you should use:

sudo update-alternatives --config pgsql-psql

尽管如此,有时您收到这样的消息:

Nevertheless, sometimes you can get such message back:

failed to link /usr/bin/psql -> /etc/alternatives/pgsql-psql: /usr/bin/psql exists and it is not a symlink

如果这样,请尝试:

ln -s /usr/pgsql-[PUT YOUR VERSION HERE(ex. 9.6)]/bin/psql /usr/local/bin/psql

这篇关于如何更正psql版本和postgresql版本的不匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆