Pages - Menu

Wednesday, October 10, 2012

PostgreSQL - Set superuser password

Hi fellas!

To set the superuser password just follow these amazing steps and be happy.

First you log as su:

[daniel@inspiron ~]$ su -
Password:
[root@inspiron ~]# su - postgres
-bash-4.1$ psql
psql (8.4.9)
Type "help" for help.

postgres=# \password postgres
Enter new password:
Enter it again:
postgres=# \q
-bash-4.1$


Second:

Finish


Ohhhh my God! You don't have the su password? Chill out and do this:

$ sudo passwd root


And define your su password

If I am allowed to you give a tip, create a user with the same name as the one you use to log in on your computer, for instance, mine is daniel, so I created a user with login and superuser access like:

CREATE ROLE your_beautiful_name LOGIN SUPERUSER;


Of course you don't have to give it a SUPERUSER permission but if you don't give it a LOGIN, guess what, it won't log in.

To check if everything went ok just:

SELECT rolname FROM pg_roles;


Adios!

No comments:

Post a Comment