解决 dropdb: could not connect to database postgres: could not connect to server:

今天在调试一个脚本的时候遇到这个错误:

dropdb: could not connect to database postgres: could not connect to server: 

这个脚本调用了postgresql的dropdb命令。

找了下资料似乎是dropdb时候找的库不对导致的。 由于这个脚本以前是对本机postgreSQL操作的,这次是对remote的postgreSQL操作的,所以测试了一下差异:

./dropdb -U postgres mydbase 默认对本机数据库操作

./dropdb -U postgres dsvdbase -h 10.**.**.**  加上了IP地址,对此IP的数据库操作

所以由于脚本所在服务器没有装postgreSQL,出了错, 给这个脚本填加-h解决

猜你喜欢

转载自zhukunrong.iteye.com/blog/1925048