欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

postgresql修改完端口后直接psql連接數(shù)據(jù)庫報錯的解決

 更新時間:2021年01月11日 14:40:12   作者:奈何流年  
這篇文章主要介紹了postgresql修改完端口后直接psql連接數(shù)據(jù)庫報錯的解決,具有很好的參考價值,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

今天修改pg的端口號port改成5435后重啟完數(shù)據(jù)庫的時候直接psql進庫的時候進不去

[postgres@node2 data]$ 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

這時,進數(shù)據(jù)庫有兩種方式

1、psql 后面加上端口號

[postgres@node2 data]$ psql -p 5435
psql (9.6.1)
Type "help" for help.
postgres=# 

2、在環(huán)境變量/home/postgres/.bash_profile中加上一句

export PGPORT=5435

然后

[postgres@node2 ~]$ source ~/.bash_profile 
[postgres@node2 ~]$ psql
psql (9.6.1)
Type "help" for help.
postgres=# 

這樣就可以直接進庫了

補充:psql不是默認端口時如何連接postgresql

psql不是默認端口時如何連接postgresql

[stork@instance-609xznso pgsql]$ /usr/pgsql-11/bin/psql c3_data -p 5432
could not change directory to “/var/lib/pgsql”: Permission denied
Password for user stork:
psql (11.5)
Type “help” for help.
c3_data=>

自己指定端口就可以了

/usr/pgsql-11/bin/psql xxdatabase -p 端口號

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。如有錯誤或未考慮完全的地方,望不吝賜教。

相關(guān)文章

最新評論