I have just installed postgres 8.4 on Ubuntu 9.10 and it has never asked me to create a superuser. Is there a default superuser and its password? If not, how do I create a new one?
|
feedback
|
|
I'm not a postgres user (I use the other one) but to reset the (Ubuntu 9.10) password for postgres, how about
and give it a new password. | |||
|
feedback
|
|
on the command line $ sudo -u postgres psql postgres # \password postgres Enter new password: | |||||
feedback
|
|
CAUTION The answer about changing the UNIX password for "postgres" through "$ sudo passwd postgres" is not prefered, and can even be DANGEROUS! This is why: By default, the UNIX account "posgres" is locked, which means it cannot be logged in through password. If you use "sudo passwd postgres", the account is immediately unlocked. Worse is if you set the password to something weak, like "postgres", then you are exposed to great security danger. For instance, there are a lot of bots out there trying username/password "postgres/postgres" to log into your UNIX system. What you should have done is following Chris James's answer. To explain it a little bit: There are usually two default ways to login PostgreSQL: By running "psql" command as a UNIX user (so-called IDENT/PEER authentication), or by TCP/IP connection using PostgreSQL's own managed username/password (so-called TCP authentication). Therefore to use PostgreSQL as the power user "postgres", you either use "psql" command as "postgres" UNIX user (e.g., through "sudo -u postgres psql"), or you use TCP/IP connection and use "postgres" username and the password that PostgreSQL manages (i.e., NOT UNIX password). So the question is you do not know the default PostgreSQL password for "postgres" username. That is why you want to reset the password using "sudo -u postgres psql". But you NEVER want to set the passwrod for UNIX account "postgres". Of course things can change if you configure it differently from the default setting. For example, one could sync the PostgreSQL password with UNIX password. That would be beyond the scope of this question. | |||
|
feedback
|
|
You manipulate postgres through the user
| |||
feedback
|
|
For windows users, type
to change your password | |||
|
feedback
|
|
Probably very relevant - "I'm installing PostgreSQL and don't know the password for the postgres user". | |||
|
feedback
|