gpt4 book ai didi

postgresql - postgres的密码

转载 作者:行者123 更新时间:2023-11-29 11:09:49 25 4
gpt4 key购买 nike

在安装它的 postgres 的简短版本中,告诉我执行以下操作

./configure
gmake
su
gmake install
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test

现在我创建了 postgres 用户,但它有时会要求我提供该用户 的凭据。 postgres 用户是否有默认密码?为什么我什至需要创建另一个 user

最佳答案

What's the default superuser username/password for postgres after a new install? :

CAUTION The answer about changing the UNIX password for "postgres" through "$ sudo passwd postgres" is not preferred, and can even be DANGEROUS!

This is why: By default, the UNIX account "postgres" is locked, which means it cannot be logged in using a password. If you use "sudo passwd postgres", the account is immediately unlocked. Worse, if you set the password to something weak, like "postgres", then you are exposed to a great security danger. For example, there are a number of bots out there trying the username/password combo "postgres/postgres" to log into your UNIX system.

What you should do is follow Chris James's answer:

sudo -u postgres psql postgres

# \password postgres

Enter new password:

To explain it a little bit...

关于postgresql - postgres的密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9832648/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com