从Mac删除PostgreSQL用户,如何恢复? [英] Deleted PostgreSQL user from mac, how to restore?

查看:27
本文介绍了从Mac删除PostgreSQL用户,如何恢复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一些非常愚蠢的事情.我在Mac上运行了一个postgreSQL,里面有几个数据库.

I did something really stupid. I was running a postgreSQL on my mac, with a few databases in it.

最近我注意到在我的登录屏幕上添加了一个名为 PostgreSQL 的新用户,但我没有找到一个更好的主意来删除该用户.

Recently I noticed a new user called PostgreSQL was added at my login screen, and I didn't find a better idea to remove this user.

现在,我的pgAdminIII不再连接到服务器,尝试连接时出现此错误:

Now, my pgAdminIII doesn't connect to the server anymore, giving this error when I try to connect:

服务器不监听服务器不接受连接:连接库报告无法连接到服务器:连接被拒绝服务器是否在主机"localhost"(:: 1)上运行并接受端口5432上的TCP/IP连接?无法连接到服务器:连接被拒绝服务器是否在主机"localhost"(127.0.0.1)上运行并在端口5432上接受TCP/IP连接?无法连接到服务器:连接被拒绝服务器是否在主机"localhost"(fe80 :: 1)上运行并在端口5432上接受TCP/IP连接?

Server doesn't listen The server doesn't accept connections: the connection library reports could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused Is the server running on host "localhost" (fe80::1) and accepting TCP/IP connections on port 5432?

如何恢复我的连接?希望没有完全重新安装我的postgres?

How can I restore my connection? Hopefully without fully re-installing my postgres??

非常感谢:)

推荐答案

您必须在管理控制台中使用短名称"postgres"创建一个新用户(该用户不应具有管理员权限),并确保它具有完全相同的名称.用户ID就像原始的"postgres"用户一样.

You must create a new user (it should not have admin rights) with the shortname "postgres" in the admin console, and make sure it has the exact same user ID as the original "postgres" user did.

如果不确定原来的用户ID是什么,可以通过查看PostgreSQL目录来查找:

If you aren't sure what the old user ID was, you can find out by looking at the PostgreSQL directory:

ls -ldn /path/to/data/directory

(数据目录的位置取决于您安装的PostgreSQL版本以及安装方式).

(The data directory location depends on the PostgreSQL version you installed, and how you installed it).

如果在Mac OS X上的用户创建期间无法指定用户ID,则需要创建用户,然后将数据目录的所有权重置为新创建的用户:

If you cannot specify the user ID during user creation on Mac OS X, you will instead need to create the user, then reset ownership of the data directory to the newly created user:

sudo chown -R postgres:postgres /path/to/data/directory

这篇关于从Mac删除PostgreSQL用户,如何恢复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆