Eliminating non-working PostgreSQL installations on Ubuntu 10.04 and starting afresh
我发现在Ubuntu 10.04上有两个旧的PostgreSQL安装的残骸:
1 2 3 4 5 6  | $ pg_lsclustersVersion Cluster   Port STATUS Owner    DATA directory                     Log file USE OF uninitialized VALUE IN printf at /usr/bin/pg_lsclusters line 38. 8.4 main 5432 down /var/lib/postgresql/8.4/main /var/log/postgresql/postgresql-8.4-main.log USE OF uninitialized VALUE IN printf at /usr/bin/pg_lsclusters line 38. 9.1 main 5433 down /var/lib/postgresql/9.1/main /var/log/postgresql/postgresql-9.1-main.log $  | 
尝试执行基本功能会返回错误,例如:
1 2 3  | createuser: could NOT CONNECT TO DATABASE postgres: 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"?  | 
当我尝试启动数据库服务器时会出现更多信息:
1 2 3 4 5  | $ sudo /etc/init.d/postgresql START  * Starting PostgreSQL 9.1 DATABASE server * Error: The cluster IS owned BY USER id 109 which does NOT exist any more ...fail! $  | 
我的问题:如何完全删除两个群集并设置一个新群集? 我已经尝试删除,清除和重新安装
首先,你联系到的答案是非常不安全的 - 手工编辑
至于
这是发生了什么:
Ubuntu使用
理想情况下,您只需使用
我把它清理干净了。我建议:
- 
验证
pg_lsclusters 是否未列出数据库集群 - 
apt-get --purge remove postgresql\* - 这很重要 - 
删除
/etc/postgresql/  - 
删除
/etc/postgresql-common  - 
删除
/var/lib/postgresql  - 
userdel -r postgres  - 
groupdel postgres  - 
apt-get install postgresql-common postgresql-9.1 postgresql-contrib-9.1 postgresql-doc-9.1  
由于您已删除用户ID等,