
PostgreSQL实现登录及修改密码操作
项目招商找A5 快速获取精准代理名单
这篇文章主要介绍了PostgreSQL 实现登录及修改密码操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧。
PostgreSQL登录
1、可通过客户端pgAdmin III直接登录
2、可通过命令行
命令:psql -h 10.10.10.10 -U user -d postgres -p 5570
-h:数据库IP
-U:登录用户
-d:登录的数据库
-p:登录端口
方法:进入postgreSQL的客户端安装目录(我的安装目录:C:\Program Files\PostgreSQL\9.4\bin),执行psql命令,其中\q表示退出数据库
修改密码
直接执行以下sql即可修改密码
1alter user pguser with password 'new password';
补充:PostgreSQL修改密码认证方式
我就废话不多说了,大家还是直接看代码吧~
[postgres@postgres_vm ~]$ psqlpsql (12.4)Type "help" for help.postgres=# show password_encryption ;password_encryption---------------------md5(1 row)postgres=# select * from pg_authid where rolname='hr';oid | rolname | rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcanlogin | rolreplication | rolbypassrls | rolconnlimit | rolpassword | rolvaliduntil-------+---------+----------+------------+---------------+-------------+-------------+----------------+--------------+--------------+-------------------------------------+---------------16386 | hr | f | t | f | f | t | f | f | -1 | md566ad2e6b6fadaa9fd11bfcab906e84c8 |(1 row)postgres=# set password_encryption to "scram-sha-256";SETpostgres=# select * from pg_authid where rolname='hr';oid | rolname | rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcanlogin | rolreplication | rolbypassrls | rolconnlimit | rolpassword | rolvaliduntil-------+---------+----------+------------+---------------+-------------+-------------+----------------+--------------+--------------+-------------------------------------+---------------16386 | hr | f | t | f | f | t | f | f | -1 | md566ad2e6b6fadaa9fd11bfcab906e84c8 |(1 row)postgres=# alter user hr with password 'Abcd1234';ALTER ROLEpostgres=# select * from pg_authid where rolname='hr';oid | rolname | rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcanlogin | rolreplication | rolbypassrls | rolconnlimit | rolpassword | rolvaliduntil-------+---------+----------+------------+---------------+-------------+-------------+----------------+--------------+--------------+---------------------------------------------------------------------------------------------------------------------------------------+---------------16386 | hr | f | t | f | f | t | f | f | -1 | SCRAM-SHA-256$4096:dF5WnZnKGXen0mtqZeWldA==$2K8sshkEarHox93X5hmIjKSPxHecXDkjZ56erjIf+dU=:FBbY3+22nVXF83LbfK6DHBK2QpakJA/0RRI3oXs4cdI= |(1 row)postgres=#
文章来源:脚本之家
来源地址:https://www.jb51.net/article/204344.htm
尊敬的看官您对PostgreSQL实现登录及修改密码操作有什么看法呢?互联网品牌制作专家愿与您共同探讨!版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请加微信号oem365 举报,一经查实,本站将立刻删除。上一篇: 基于PostgreSQL密码重置操作 返 回 下一篇:Postgresql默认用户名与密码的操作