postgresql 在 PgAdmin 中查看数据库用户和密码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23666348/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
View database user and password in PgAdmin
提问by Samy
How do I change a user's password in Postgresql (using PgAdmin) so that I can connect with Rails to the Postgres database using these credentials?
如何在 Postgresql(使用 PgAdmin)中更改用户的密码,以便我可以使用这些凭据通过 Rails 连接到 Postgres 数据库?
So far: In PgAdmin I right clicked the database name, clicked Create Script and then typed the command:
到目前为止:在 PgAdmin 中,我右键单击数据库名称,单击创建脚本,然后键入命令:
CREATE USER usr1 WITH PASSWORD 'pwd1!@#$';
CREATE USER usr1 WITH PASSWORD 'pwd1!@#$';
Question: where exactly in PgAdmin am I able to see the user and password or list of users and passwords? So far I am unable to see this in Db properties --> 'privileges'?? Any tips on other security elements? or something that can be improved in my current methods? Thanks a lot.
问题:我可以在 PgAdmin 的哪个位置看到用户和密码或用户和密码列表?到目前为止,我无法在 Db 属性中看到这一点 --> 'privileges'?? 关于其他安全元素的任何提示?或者可以在我目前的方法中改进的东西?非常感谢。
回答by klin
Login roles are common for all databases in a server. You can see them in the bottom of the object browser (left panel). To execute arbitrary SQL query open Query tool (Ctrl-E) from Tools in main menu or click on icon with 'SQL' (previously you have to select a database). To change user password execute SQL:
登录角色对于服务器中的所有数据库都是通用的。您可以在对象浏览器(左侧面板)的底部看到它们。要执行任意 SQL 查询,请从主菜单中的工具打开查询工具 (Ctrl-E) 或单击带有“SQL”的图标(以前您必须选择一个数据库)。要更改用户密码,请执行 SQL:
ALTER ROLE username PASSWORD 'newpassword'
ALTER USER
is an alias for ALTER ROLE
. Read about it in documentation.
ALTER USER
是 的别名ALTER ROLE
。在文档中阅读它。
回答by David Martinez
In the file "pgpass.conf" in this path:
在此路径中的文件“pgpass.conf”中:
C:\Users\[User's name]\AppData\Roaming\postgresql
回答by utkarsh
Run the query from pgadmin:
从 pgadmin 运行查询:
SELECT rolname, rolpassword FROM pg_authid;
This requires superuser privileges to protect the password.
这需要超级用户权限来保护密码。