Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

postgresql - Getting back Server in PgAdmin prompts error “FATAL: password authentication failed for user “postgres“;“;

I have recently installed the PostgreSQL 12 and the PgAdmin 4 on my laptop running Ubuntu 18.04.5 LTS.

Everything was fine, I opened the PgAdmin 4, it asked me for a password, I put a password admin and then I was able to see the main window in PgAdmin 4. Unfortunately, by a mistake, I deleted the Server that I could see via PgAdmin, and now I do not have one.

When I try to create a new Server "PostgreSQL 12" with a password admin, see image below

pg_admin_window

I am getting the following error:

Unable to connect to server:

FATAL: password authentication failed for user "postgres"

I have seen these threads: Postgresql: password authentication failed for user “postgres” and FATAL: password authentication failed for user “postgres” (postgresql 11 with pgAdmin 4), but none of the solutions helps me, i.e. putting passwords like admin, ident, postgres, password, password of my Ubuntu account, an empty password. Empty passwords prompts a notification

Unable to connect to server:

fe_sendauth: no password supplied

Probably the PostgreSQL is running correctly, because I can see tables that I created for a project and I can also manipulate them.

A result of l command shows:

postgres=# l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges    
-----------+----------+----------+-------------+-------------+------------------------
 postgres  | postgres | UTF8     | en_GB.UTF-8 | en_GB.UTF-8 | 
 template0 | postgres | UTF8     | en_GB.UTF-8 | en_GB.UTF-8 | =c/postgres           +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_GB.UTF-8 | en_GB.UTF-8 | =c/postgres           +
           |          |          |             |             | postgres=CTc/postgres
 test_db   | postgres | UTF8     | en_GB.UTF-8 | en_GB.UTF-8 | =Tc/postgres          +
           |          |          |             |             | postgres=CTc/postgres +
           |          |          |             |             | test_user=CTc/postgres
(4 rows)

A result of du gives:

psql (12.5 (Ubuntu 12.5-1.pgdg18.04+1))
Type "help" for help.

postgres=# du
                                   List of roles
 Role name |                         Attributes                         | Member of 
-----------+------------------------------------------------------------+-----------
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
 test_user |                                                            | {}

And a result of SELECT * FROM pg_roles is:

          rolname          | rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcanlogin | rolreplication | rolconnlimit | rolpassword | rolvaliduntil | rolbypassrls | rolconfig |  oid  
---------------------------+----------+------------+---------------+-------------+-------------+----------------+--------------+-------------+---------------+--------------+-----------+-------
 pg_signal_backend         | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |           |  4200
 pg_read_server_files      | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |           |  4569
 postgres                  | t        | t          | t             | t           | t           | t              |           -1 | ********    |               | t            |           |    10
 pg_write_server_files     | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |           |  4570
 pg_execute_server_program | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |           |  4571
 pg_read_all_stats         | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |           |  3375
 pg_monitor                | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |           |  3373
 pg_read_all_settings      | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |           |  3374
 pg_stat_scan_tables       | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |           |  3377
 test_user                 | f        | t          | f             | f           | t           | f              |           -1 | ********    |               | f            |           | 16385

Reinstalling PostgreSQL and PgAdmin did not resolve my issue as well.

So, my question is how can I resolve the problem I am facing to be able to see my tables in PgAdmin?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...