I happen to have 2 installed instances of postgresql at my machine: 9.1 and 9.2:

sudo service postgresql status
9.1/main (port 5432): down
9.2/main (port 5433): down

They are located at /etc/postgresql/9.1/ and /etc/postgresql/9.2/. Then I run 9.2 by saying sudo service postgresql start

But this command fails:

$ psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

I really want to use 9.2 only, I don't need 2 instances.

Do you have any idea of how to either remove 9.1 safely or make 9.2 to be the main, default instance?

-------------------------------------------------------------------------------------------------------

This situation with two clusters in Ubuntu may happen when upgrading to a newer release providing an newer postgresql version.

The automatic upgrade does not remove the old cluster, presumably for fear of erasing valuable data (which is wise because some postgres upgrades may require human work to be complete).

If you know you want to drop it, just run:

sudo pg_dropcluster --stop 9.1 main 

The corresponding data directory will be removed and service postgresql will no longer refer to 9.1

At this point the 9.2 cluster will still use the port 5433, which is unpractical.

To switch it to the default port, edit /etc/postgresql/9.2/main/postgresql.conf and change the line port = 5433 to port = 5432

Then restart PostgreSQL.

Finally to get rid of the postgresql-9.1 packages see the result of dpkg -l 'postgresql*9.1*'

最新文章

  1. 【平面设计AFTER】读到的设计海报分层法
  2. 机器学习PR:k近邻法分类
  3. hihocoder #1333 : 平衡树·Splay2
  4. Silverlight管理系统源码(用于开发ERP、OA、CRM、HR、进销存、财务等系统之用)
  5. Plus One Linked List
  6. YAML 语言语法
  7. Hbase Interface HConnection
  8. HDU 1069 Monkey and Banana(动态规划)
  9. word-wrap同word-break的区别
  10. HTML canvas 笑脸
  11. Build to win--来自小黄衫
  12. hive中left/right join on连接中and与where的使用问题
  13. java8 Stream操作
  14. 使用Visual Studio给SQL生成测试数据
  15. 点击select下拉框获取option的属性值
  16. 反射简化switch语句
  17. python工具 - 读取文件的部分指定内容并输出到外置窗口
  18. react native 中使用swiper
  19. 浅谈Java中static关键字、权限修饰符
  20. Windows中的键盘快捷方式大全

热门文章

  1. shell set理解
  2. Intellij 下 mybatis 插件 MyBatisCodeHelperPro破解
  3. Jmeter接口测试---webservices
  4. Context Switches msdn
  5. Vue指令1:v-text及v-html
  6. 手机中快速看图,浏览编辑DWG 梦想极光CAD
  7. 日常开发需要掌握的Git命令
  8. sql常用手法(二)
  9. 洛谷——P2236 [HNOI2002]彩票
  10. mysql数据库主从操作记录