S
S
SEOD2020-02-27 14:56:10
PostgreSQL
SEOD, 2020-02-27 14:56:10

Unable to dump pg_dump. How to deal with roles in Postgres?

I've been fighting for an hour now, I don't understand why such a bunch of commands have been made, which the devil knows how they work.
The task is simple: dump the base. Is there a way to find out what roles and what privileges apply to a database? Who has the ability to dump? Right now I only get this:

$ sudo -u postgres psql
\connect mydb;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO backup;
GRANT

$ psql -d mydb                       
psql (12.1 (Ubuntu 12.1-1.pgdg18.04+1), сервер 10.10 (Ubuntu 10.10-0ubuntu0.18.04.1))
Введите "help", чтобы получить справку.
trading=> GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO backup;
WARNING:  no privileges were granted for "sent_messages"
GRANT

$ pg_dump -U backup mydb > 1.bak
pg_dump: [archiver (db)] connection to database "mydb" failed: FATAL:  Peer authentication failed for user "backup"

What is wrong here, how to figure it out?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2020-02-27
@SEOVirus

And what's the point of talking about rights if you haven't even connected to the database?
If you want to simply and not deal with the rights - from postgres and take a dump. sudo -u postgres pg_dump ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question