To change the postgres user password, type the command:
$ sudo passwd postgres
After executing the command the following messages will appear:
Digite a nova senha UNIX:
Redigite a nova senha UNIX:
Enter your password and write it down next. Once done, we will log in with the postgres user.
$ su postgres
The password that will be required is the same one we just changed.
Now let’s change the password to connect to the bank.
This command is for version 7 or higher:
$ psql -c "ALTER USER postgres WITH PASSWORD 'nova_senha'" -d template1
Where nova_senha
will be the password you want.
Source: vivaolinux.
An answer with just the link is bad practice here. If that link disappears one day, then that answer is garbage. If you improve the answer with good content I vote +1
– Sergio
Wow, I hadn’t even thought about it. I’m sorry, I’ll edit the answer. I thought it would be wrong to copy the content from another site.
– fymoribe
You can copy the content if you refer from where you copied it.
– Sergio
Edited, thanks for understanding had not thought of this possibility.
– fymoribe
If possible @fymoribe puts the command parts inside tags: `` to highlight the command, e.g.:
$ su postgres
– iTSangar
Changed @iTSangar
– fymoribe