一 将用户设为密码登录方式
1 修改用户的密码
sudo -u postgres psql -c "ALTER USER yuhui WITH PASSWORD 'xinmima';"
2 修改配置,指定用户yuhui使用密码登录
sudo vi /etc/postgresql/16/main/pg_hba.conf
local all postgres peer
local all yuhui md5
在postgres下新增一行,指定yuhui的登录方式为md5
3 重启postgresql数据库服务文章来源:https://www.toymoban.com/news/detail-858113.html
sudo service postgresql restart
4 然后执行登录命令文章来源地址https://www.toymoban.com/news/detail-858113.html
psql -U yuhui -W -d database
到了这里,关于PgSQL的登录相关(Ubuntu22.04)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!