如何在Mac上重新开始使用PostgreSQL?

huangapple go评论58阅读模式
英文:

How to start fresh with PostgreSQL on Mac?

问题

  1. 我在大约6-7年前在我的Mac上使用PostgreSQL做了一些工作。我现在正在尝试重新使用它,并按照教程进行操作。有两个问题涉及到了我之前的配置。

  2. 我安装了来自postgresapp.com的最新版本的PostgreSQL(15),但出现了以下错误消息:
    PostgreSQL版本错误

  3. 我尝试了我在另一个stackoverflow问题中找到的卸载步骤,以及运行了以下命令我使用的命令,但这并没有解决问题。因为当我安装最新版本时,我仍然会遇到与上述问题#2中提到的相同错误,并且psql命令仍然提示我输入我不记得的密码。

  4. 请问是否有人可以提供必要的步骤来在Mac上“重新开始”使用PostgreSQL,或者指向一个在线资源来解释它?到目前为止,我找到的所有内容都没有起作用。

英文:

So, I did some work on my Mac with PostgreSQL about 6-7 years ago. I am trying to get back into it and am following along with a tutorial. There are two issues that I have ran into regarding my pre existing configurations.

  1. I do not know the password I used when I originally set up PostgreSQL and the postgres user on my machine.
  2. I installed the latest version of PostgreSQL (15) from postgresapp.com but am getting the following error message:
    PostgreSQL version error

I tried steps I found on another stackoverflow question for uninstalling as well as running the following commands commands I used but this has not fixed the issue as when I install the latest version I get the same error mentioned in #2 above and the psql command still prompts me to enter a password that I do not remember.

Could someone help with providing the necessary steps to start "fresh" with PostgreSQL on mac or point me to an online resource that explains it? Everything I have found so far has not worked.

答案1

得分: 2

如果你不需要之前的任何设置或数据,并且你愿意删除它们,你可以尝试删除第一次安装Postgres.app时创建的整个目录。

你能打开Postgres.app并查看你的服务器设置吗?就像下面的截图中所示?

如何在Mac上重新开始使用PostgreSQL?

如果可以的话,那将告诉你你的设置和数据存储在哪里。对我来说,它在我的主目录的 Application Support 文件夹中。

只要你确信你不需要之前的任何数据和设置,你应该可以删除整个 Postgres 文件夹。注意:这也会删除当前版本的Postgres的任何数据/设置,但听起来对你来说不会有问题。

PS:我可以在截图底部看到两个奇怪的红色方块,这似乎表明某处没有正确处理PNG的透明部分。

英文:

If you don't need any of the previous settings or data and you're happy to delete them, you can try deleting the entire directory that was established the first time you installed Postgres.app.

Can you open Postgres.app and look at your server settings, as in the screenshot below?

如何在Mac上重新开始使用PostgreSQL?

If so, that will tell you where your settings and data are being stored, For me, it's in my home directory's Application Support folder.

As long as you're 100% certain that you don't need any of your previous data and settings, you should be able to delete the entire Postgres folder. Note: this will also delete any data/settings from the current version of postgres, but it doesn't sound like that will be a problem for you.

PS: I can see two weird red squares at the bottom of my screenshot which seems like something somewhere is not correctly handling the transparent parts of the PNG.

答案2

得分: 0

  1. 关于你的PostgreSQL用户密码,你可以按照这个Stack Overflow问题的建议来更改它。步骤基本相同,但需要在你的计算机上修改postgreSQL配置目录路径。解决问题的关键是以超级用户、root用户或其他权限登录到系统,并确保在你的postgreSQL服务器配置中允许通过Unix套接字连接和登录而无需密码。

  2. 关于你的版本问题:在你的计算机上安装两个版本的PostgreSQL(旧版和v15),然后按照官方文档的说明迁移你的数据库以适应最新版本。另一种方法是使用pg_dump命令,你可以在互联网上搜索其用法和手册。

英文:
  1. Regarding your postgres user password, you can follow advice from this Stack Overflow question to change it. It's pretty much the same steps, but with changing the postgreSQL configuration directory path on your machine. The key to solve your problem is to login on your system as a super user or root or whatever it is. and make sure it's allowed {in your postgreSQL server configuration } to connect and login via unix socket without requiring the password.

  2. Regarding your version issue: install both version of PostgreSQL on your machine (the old one and the v15) then follow along with the official docs to migrate your database to work on latest versions. Another approach is to use pg_dump commands which you can search for its usage and manual online on the internet.

huangapple
  • 本文由 发表于 2023年2月8日 09:26:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/75380560.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定