如何更正psql版本和postgresql版本的不匹配?

编程入门 行业动态 更新时间:2024-10-22 16:39:56
本文介绍了如何更正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版本的不匹配?

本文发布于:2023-10-25 08:20:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1526436.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:版本   不匹配   psql   postgresql

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!