2 instances of postgresql but I really need one [closed]
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*'
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 25岁的心里话
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现