Thread: How to recover or resent the password for the user 'postgres'

How to recover or resent the password for the user 'postgres'

From
Arup Rakshit
Date:
Hi,

I am trying to follow what has been mentioned below **Setting Up Postgres**
(https://www.digitalocean.com/community/tutorials/how-to-setup-ruby-on-rails-with-postgres).

But no luck!

[shreyas@myapp(add_postgres_addapter)]$ su - postgres
Password:
su: Sorry
[shreyas@myapp (add_postgres_addapter)]$

It is asking me the password, whereas I don't know the password of the user `postgres`. How would I create a new role
witha password in this case ? 

I am using OS X version 10.8.2
 Regards,
Arup Rakshit


Re: How to recover or resent the password for the user 'postgres'

From
Michael Paquier
Date:


On Mon, Mar 30, 2015 at 5:09 PM, Arup Rakshit <aruprakshit@rocketmail.com> wrote:
Hi,

I am trying to follow what has been mentioned below **Setting Up Postgres** (https://www.digitalocean.com/community/tutorials/how-to-setup-ruby-on-rails-with-postgres).

But no luck!

[shreyas@myapp(add_postgres_addapter)]$ su - postgres
Password:
su: Sorry
[shreyas@myapp (add_postgres_addapter)]$

It is asking me the password, whereas I don't know the password of the user `postgres`. How would I create a new role with a password in this case ?

The user whose password has visibly been lost is not the database user postgres, but the OS user postgres. If you have root on this server access, simply enforce the password to a new value.
--
Michael

Re: How to recover or resent the password for the user 'postgres'

From
John McKown
Date:
On Mon, Mar 30, 2015 at 3:09 AM, Arup Rakshit
<aruprakshit@rocketmail.com> wrote:
> Hi,
>
> I am trying to follow what has been mentioned below **Setting Up Postgres**
(https://www.digitalocean.com/community/tutorials/how-to-setup-ruby-on-rails-with-postgres).
>
> But no luck!
>
> [shreyas@myapp(add_postgres_addapter)]$ su - postgres
> Password:
> su: Sorry
> [shreyas@myapp (add_postgres_addapter)]$
>
> It is asking me the password, whereas I don't know the password of the user `postgres`. How would I create a new role
witha password in this case ? 

I'm not a Mac person. But, on Linux, what I do is:

 [shreyas@myapp(add_postgres_addapter)]$ sudo su - #change to root
 [root@myapp(add_postgres_addapter)]# su - postgres # change to postgres
 [postgres@myapp(add_postgres_addapter)]$ #do work as user postgres
 [postgres@myapp(add_postgres_addapter)]$exit #return to root
 [root@myapp(add_postgres_addapter)]# exit #return to my normal user
 [shreyas@myapp(add_postgres_addapter)]$

Note that the above is just my editing of what I _think_ you _might_
see. The commands are correct. This assumes you have authority to do
the "sudo su -" to change to root. This is how I change to root
because it does not require that I use the root password. Once in
root, you can "su postgres" to change to the postgres user, without a
password.

Another possibility, again using sudo would be to change the password
on the postgres user like:

[user@system]$ sudo passwd postgres
Changing password for user postgres.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[user@system]$



>
> I am using OS X version 10.8.2
>  Regards,
> Arup Rakshit



--
If you sent twitter messages while exploring, are you on a textpedition?

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown


Re: How to recover or resent the password for the user 'postgres'

From
Adrian Klaver
Date:
On 03/30/2015 01:09 AM, Arup Rakshit wrote:
> Hi,
>
> I am trying to follow what has been mentioned below **Setting Up Postgres**
(https://www.digitalocean.com/community/tutorials/how-to-setup-ruby-on-rails-with-postgres).
>
> But no luck!
>
> [shreyas@myapp(add_postgres_addapter)]$ su - postgres
> Password:
> su: Sorry
> [shreyas@myapp (add_postgres_addapter)]$
>
> It is asking me the password, whereas I don't know the password of the user `postgres`. How would I create a new role
witha password in this case ? 

How did you install Postgres?

>
> I am using OS X version 10.8.2
>   Regards,
> Arup Rakshit
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: How to recover or resent the password for the user 'postgres'

From
Arup Rakshit
Date:
On Monday, March 30, 2015 06:27:19 AM Adrian Klaver wrote:
> On 03/30/2015 01:09 AM, Arup Rakshit wrote:
> > Hi,
> >
> > I am trying to follow what has been mentioned below **Setting Up Postgres**
(https://www.digitalocean.com/community/tutorials/how-to-setup-ruby-on-rails-with-postgres).
> >
> > But no luck!
> >
> > [shreyas@myapp(add_postgres_addapter)]$ su - postgres
> > Password:
> > su: Sorry
> > [shreyas@myapp (add_postgres_addapter)]$
> >
> > It is asking me the password, whereas I don't know the password of the user `postgres`. How would I create a new
rolewith a password in this case ? 
>
> How did you install Postgres?

I didn't install. I joined a company as an Application developer, where the machine I have been assigned had PostgreSql
alreadyinstalled. I changed the configuration of the pg_hba.config as *trust*, and it worked. 

Thanks for the help to all of you.

--
================
Regards,
Arup Rakshit
================
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as
possible,you are, by definition, not smart enough to debug it. 

--Brian Kernighan