gpt4 book ai didi

postgresql - 是否可以在不破坏现有数据库的情况下安装 Postgresql?

转载 作者:行者123 更新时间:2023-12-04 19:11:05 27 4
gpt4 key购买 nike

我在 Ubuntu 18.04 上安装了 Postgresql 10,但不知何故坏了,不会重新启动。我可以重新安装它而不破坏它的数据库,以便我可以再次访问数据库吗? pg_dump 不起作用。

最佳答案

是的,你可以这么做。
默认情况下,您的数据库和其他重要文件存储在 PGDATA 中。

Traditionally, the configuration and data files used by a database cluster are stored together within the cluster's data directory, commonly referred to as PGDATA (after the name of the environment variable that can be used to define it). A common location for PGDATA is /var/lib/pgsql/data.



https://www.postgresql.org/docs/10/storage-file-layout.html

我不知道您将如何卸载 PostgreSQL,但请务必保留 PGDATA。
(yum 或 apt 不会删除 PGDATA)
重新安装 PostgreSQL 后,确保使用现有的 PGDATA 启动 PostgreSQL
pg_ctl start -D YOUR_EXISTING_PGDATA/

关于postgresql - 是否可以在不破坏现有数据库的情况下安装 Postgresql?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55581913/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com