[postgres@redhat6 ~]$ /opt/pgsql9.2beta/bin/psql -p 1922 psql: connection pointer is NULL
2 用 9.0 客户端正常
1 2 3 4 5
[postgres@redhat6 ~]$ psql -h 127.0.0.1 -p 1922 psql (9.0.2, server 9.2beta1) WARNING: psql version 9.0, server version 9.2. Some psql features might not work. Type "help"for help.
备注:后来 GOOGLE 下,没查到有用信息,后来猜想可能是环境变量没有正确设置,因为在这台主机上已经安装了 postgresql9.0.2,环境变量没有做相应修改。
3 系统postgres 用户环境变量
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH exportPGPORT=1921 exportPGDATA=/opt/pgdata/pg_root exportLANG=en_US.utf8 exportPGHOME=/opt/pgsql9.0 exportLD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib exportDATE=`date +"%Y%m%d%H%M"` exportPATH=$PGHOME/bin:$PATH:. exportMANPATH=$PGHOME/share/man:$MANPATH alias rm='rm -i' alias ll='ls -lh'
备注:以上是 postgresql 用户环境变量
4 在 session 端修改环境变量
1 2 3 4 5 6 7 8 9 10
exportPGPORT=1922 exportPGDATA=/database/pgdata9.2/pg_root exportLANG=en_US.utf8 exportPGHOME=/opt/pgsql9.2beta exportLD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib exportDATE=`date +"%Y%m%d%H%M"` exportPATH=$PGHOME/bin:$PATH:. exportMANPATH=$PGHOME/share/man:$MANPATH alias rm='rm -i' alias ll='ls -lh'
5 再次测试
1 2 3
[postgres@redhat6 ~]$ /opt/pgsql9.2beta/bin/psql -p 1922 psql (9.2beta1) Type "help"for help.
备注:登陆成功,经过测试,导入正确的 LD_LIBRARY_PATH 环境变量后,问题解决!
6 End 为了方便可以将上面环境变量写到一个文件里,需要用时在 session 端 source 一下即可。