一 将用户设为密码登录方式
1 修改用户的密码
sudo -u postgres psql -c "ALTER USER yuhui WITH PASSWORD 'xinmima';"2 修改配置,指定用户yuhui使用密码登录
sudo vi /etc/postgresql/16/main/pg_hba.conflocal   all             postgres                                peer
local   all             yuhui                                   md5在postgres下新增一行,指定yuhui的登录方式为md5
3 重启postgresql数据库服务
sudo service postgresql restart4 然后执行登录命令
psql -U yuhui -W -d database