B
B
BonBon Slick2017-09-12 12:26:49
PostgreSQL
BonBon Slick, 2017-09-12 12:26:49

PostgreSQL role settings?

I installed Postgresql 9.6 on Debian, I want to set everything up correctly, I don’t know how, in tutorials, like in Google, they don’t give out the standard password for this user: https://www.digitalocean.com/community/tutorials/h...
Therefore, I I can't delete the test database because it asks for a password

[email protected]_serv:~$ sudo drop 'my_db_name'

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for postgres:
[email protected]_serv:~$

My configs:
local   all             postgres                                peer
local   all             all                                         peer
host    all             all             127.0.0.1/32         md5
host    all             all             ::1/128                 md5

I created a new user in --interactive mode , but the password is unknown. Can't do sudo adduser sammy
And much more.
Please tell me what is the password? Are the configs correct? Do I need another user, or will the standard one do? How to change his name and password for security purposes?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Melkij, 2017-09-12
@BonBonSlick

sudo why?
If you are already logged in as the user under whose name the database is running (typically postgres), then administrative actions from this user are performed.
The postgres user does not have a password out of the box and this is not a security issue, because you can log in as postgres to the database only if you are already logged in as postgres to the system, and for this you need sudo or root rights.

X
x67, 2017-09-12
@x67

write a command from your default user with sudo rights in the terminal.
After that, on behalf of the postgres user, run the utility
in it, you can manage databases, roles and everything else.
The commands are all from the manuals, to remove the test database, use

DROP DATABASE <dbname>; 
#В конце там точка с запятой - сигнал завершения команды, а название базы пишется без кавычек или в двойных кавычках

Now I explain. When you installed the server, you got a Linux postgres user and a role inside the DBMS. The role has superuser rights, in fact, being a superuser. There is no password initially, to enter the role you need to either set a password or run psql as a Linux postgres user, which is done above

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question