Psql ошибка важно роль user не существует

I have been reading this tutorial. There is the below command to login as a user:

# login as user "user"
psql -U user

when I execute the above command, I get an error saying the following:

psql: FATAL:  role "user" does not exist

The only help I saw online was here, the have said the following:

FATAL: role «myusername» does not exist

By default PostgreSQL connects to the PostgreSQL user with the same
name as the current unix user. You have not created a PostgreSQL user
by that name in your database.

Create a suitable user, or specify a different username to connect
with. In the command line tools the -U flag does this.

But I still don’t quite understand why I am getting this error.

halfer's user avatar

halfer

19.8k17 gold badges99 silver badges185 bronze badges

asked Sep 3, 2015 at 10:59

Alexander Solonik's user avatar

Alexander SolonikAlexander Solonik

9,75818 gold badges73 silver badges174 bronze badges

1

You have first to login in a linux shell as the user postgres and than create new postgres user with the command createuser. The system user postgres is created automatically by the Postgres installer.

Execute this code in the console (change your_username with a username of your choice):

sudo -u postgres -i
createuser -l -d -P your_username

Better you create a database with the same name too (this makes the login later easier):

createdb your_username -O your_username

Then you should be able to connect in psql with

psql -h localhost -U your_username

answered Sep 3, 2015 at 13:07

Tom-db's user avatar

Please check to see if the user exists.

dg

If not, you need what is missing in the tutorial and you edit it if necessary.

CREATE USER user WITH PASSWORD '<here you password>';

answered Sep 3, 2015 at 12:45

René's user avatar

RenéRené

813 bronze badges

I’m setting up my PostgreSQL 9.1. I can’t do anything with PostgreSQL: can’t createdb, can’t createuser; all operations return the error message

Fatal: role h9uest does not exist

h9uest is my account name, and I sudo apt-get install PostgreSQL 9.1 under this account.
Similar error persists for the root account.

Erwin Brandstetter's user avatar

asked Aug 12, 2012 at 3:00

h9uest's user avatar

7

Use the operating system user postgres to create your database — as long as you haven’t set up a database role with the necessary privileges that corresponds to your operating system user of the same name (h9uest in your case):

sudo -u postgres -i

As recommended here or here.

Then try again. Type exit when done with operating as system user postgres.

Or execute the single command createuser as postgres with sudo, like demonstrated by
dsrees in another answer.

The point is to use the operating system user matching the database role of the same name to be granted access via ident authentication. postgres is the default operating system user to have initialized the database cluster. The manual:

In order to bootstrap the database system, a freshly initialized
system always contains one predefined role. This role is always a
“superuser”, and by default (unless altered when running initdb) it
will have the same name as the operating system user that initialized
the database cluster. Customarily, this role will be named postgres.
In order to create more roles you first have to connect as this
initial role.

I have heard of odd setups with non-standard user names or where the operating system user does not exist. You’d need to adapt your strategy there.

Read about database roles and client authentication in the manual.

answered Aug 12, 2012 at 4:13

Erwin Brandstetter's user avatar

Erwin BrandstetterErwin Brandstetter

597k144 gold badges1059 silver badges1218 bronze badges

6

After trying many other people’s solutions, and without success, this answer finally helped me.

https://stackoverflow.com/a/16974197/2433309

In short, running

sudo -u postgres createuser owning_user

creates a role with name owning_user (in this case, h9uest). After that you can run rake db:create from the terminal under whatever account name you set up without having to enter into the Postgres environment.

Vaibhav Mule's user avatar

Vaibhav Mule

4,9864 gold badges35 silver badges52 bronze badges

answered Sep 9, 2013 at 23:27

dsrees's user avatar

dsreesdsrees

6,0662 gold badges26 silver badges26 bronze badges

9

sudo su - postgres

psql template1

creating role on pgsql with privilege as «superuser»

CREATE ROLE username superuser;
eg. CREATE ROLE demo superuser;

Then create user

CREATE USER username; 
eg. CREATE USER demo;

Assign privilege to user

GRANT ROOT TO username;

And then enable login that user, so you can run e.g.: psql template1, from normal $ terminal:

ALTER ROLE username WITH LOGIN;

the's user avatar

the

20.9k11 gold badges68 silver badges101 bronze badges

answered May 29, 2014 at 13:35

Mohammed Saleem's user avatar

Mohammed SaleemMohammed Saleem

1,8731 gold badge11 silver badges6 bronze badges

5

This works for me:

psql -h localhost -U postgres

ssbl's user avatar

ssbl

432 silver badges6 bronze badges

answered Aug 12, 2014 at 11:39

mateusz.szymborski's user avatar

4

Installing postgres using apt-get does not create a user role or a database.

To create a superuser role and a database for your personal user account:

sudo -u postgres createuser -s $(whoami); createdb $(whoami)

answered Jul 18, 2016 at 19:01

Miles Erickson's user avatar

Miles EricksonMiles Erickson

2,5742 gold badges17 silver badges18 bronze badges

2

psql postgres

postgres=# CREATE ROLE username superuser;
postgres=# ALTER ROLE username WITH LOGIN;

answered Apr 7, 2019 at 15:08

Abel's user avatar

AbelAbel

3,94932 silver badges31 bronze badges

4

For version Postgres 9.5 use following comand:

psql -h localhost -U postgres

Hope this will help.

answered Jan 13, 2019 at 5:07

Kalyan Halder's user avatar

0

Working method,

  1. vi /etc/postgresql/9.3/main/pg_hba.conf
  2. local all postgres peer
    here change peer to trust
  3. restart, sudo service postgresql restart

  4. now try, psql -U postgres

answered Sep 10, 2017 at 16:23

Mohideen bin Mohammed's user avatar

2

I did a healthcheck with docker-compose.

healthcheck:
  test: ['CMD-SHELL', 'pg_isready']
  interval: 5s
  timeout: 5s
  retries: 5

If you also have that change the user:

healthcheck:
  test: ['CMD-SHELL', 'pg_isready -U postgres'] # <<<---
  interval: 5s
  timeout: 5s
  retries: 5

answered Aug 7, 2021 at 8:07

Jan's user avatar

JanJan

12.1k9 gold badges52 silver badges88 bronze badges

For Windows users : psql -U postgres

You should see then the command-line interface to PostgreSQL: postgres=#

answered Feb 8, 2019 at 12:13

Andriy Tolstoy's user avatar

Andriy TolstoyAndriy Tolstoy

5,6402 gold badges31 silver badges30 bronze badges

1

In local user prompt, not root user prompt, type

sudo -u postgres createuser <local username>

Then enter password for local user.

Then enter the previous command that generated «role ‘username’ does not exist.»

Above steps solved the problem for me.
If not, please send terminal messages for above steps.

Erwin Brandstetter's user avatar

answered Jun 21, 2015 at 20:28

Robert Cambil's user avatar

0

Manually creating a DB cluster solved it in my case.

For some reason, when I installed postgres, the «initial DB» wasn’t created. Executing initdb did the trick for me.

This solution is provided in the PostgreSQL Wiki — First steps:

initdb

Typically installing postgres to your OS creates an «initial DB» and starts the postgres server daemon running. If not then you’ll need to run initdb

Community's user avatar

answered Aug 28, 2018 at 19:53

Natacha's user avatar

NatachaNatacha

1,12415 silver badges23 bronze badges

0

sudo -u postgres createuser --superuser $USER

sudo -u postgres createdb $USER

This should definitely work for you.

answered Jul 25, 2022 at 13:05

Boy Nandi's user avatar

dump and restore with --no-owner --no-privileges flags

e.g.

dump — pg_dump --no-owner --no-privileges --format=c --dbname=postgres://userpass:username@postgres:5432/schemaname > /tmp/full.dump

restore — pg_restore --no-owner --no-privileges --format=c --dbname=postgres://userpass:username@postgres:5432/schemaname /tmp/full.dump

answered Jul 25, 2019 at 12:29

srghma's user avatar

srghmasrghma

4,7202 gold badges38 silver badges54 bronze badges

for those who using docker and correctly followed the instructions from official doc, if you still met this problem, RESTART windows and try again.

answered Apr 27, 2022 at 4:57

Siwei's user avatar

SiweiSiwei

19.5k6 gold badges74 silver badges94 bronze badges

Follow These Steps and it Will Work For You :

  1. run msfconsole
  2. type db_console
  3. some information will be shown to you chose the information who tell you to make: db_connect user:pass@host:port.../database sorry I don’t remember it but it’s like this one then replace the user and the password and the host and the database with the information included in the database.yml in the emplacement: /usr/share/metasploit-framework/config
  4. you will see. rebuilding the model cache in the background.
  5. Type apt-get update && apt-get upgrade after the update restart the terminal and lunch msfconsole and it works you can check that by typing in msfconsole: msf>db_status you will see that it’s connected.

always-a-learner's user avatar

answered Aug 17, 2017 at 10:20

Loli Pronoms's user avatar

Follow these steps to get postgres working.

  1. In your terminal, locate the Application Support folder with the following command.
    /Users/[name of the user]/library/application support
  2. Delete the application, Postgres.
  3. Reinstall the app and it should work just fine.

answered Jul 11, 2021 at 5:48

Oteri Eyenike's user avatar

Something as simple as changing port from 5432 to 5433 worked for me.

answered Aug 12, 2020 at 0:23

Guka Nozadze's user avatar

1

Перейти к контенту

ВНИМАНИЕ ! ! ! Если мы работаем от root пользователя, то мы не сможем подключиться к СУБД PostgreSQL. Мы получим ошибку вида.

psql: ошибка: подключиться к серверу через сокет "/var/run/postgresql/.s.PGSQL.5432" не удалось: ВАЖНО: роль "root" не существует

PostgreSQL - роль root не существует

PostgreSQL — роль root не существует

Нам нужно изменить пользователя в терминале Debian. Меняем root на кого? После установки PostgreSQL в систему, вместе с ней устанавливается и новый пользователь. Его зовут postgres. По умолчанию он не имеет пароля для входа.

Команда смены пользователя root на postgres в Debian:

su - postgres

Обратите внимание на терминальную оболочку. В ней изменилась запись пользователя:

Сменили пользователя root на postgres в Debian

Сменили пользователя root на postgres в Debian

Теперь мы сможем работать с утилитой psql. Подключаемся к СУБД при помощи утилиты:

psql

Нам возвращаются версии ПО.

Вызвали psql от имени postgres в Debian

Вызвали psql от имени postgres в Debian

Обратите внимание на самую низкую запись:

postgres=#

Она говорит о том, что теперь мы находимся в самом интерфейсе СУБД PostgreSQL. Ещё она говорит о том, что мы сразу подключились к базе данных, которая тоже называется postgres. Есть пользователь postgres, а есть база данных postgres. Оба они устанавливаются по умолчанию. Не путайте! С этого момент мы можем начать вводить команды.

Во внутреннем интерфейсе вводим мета-команду:

du
или
dg

Вы получите список доступных пользователей в системе PostgreSQL. Вам будут известны их атрибуты ролей и список групп ролей, членами которых они являются.

Вызвали команду du в интерфейсе СУБД PostgreSQL в Debian

Вызвали команду du в интерфейсе СУБД PostgreSQL в Debian

В нашем случае есть только один пользователь. Это тот самый postgres, от имени которого мы подключились к СУБД.

Справка

Метакоманды — это всё, что вводится в psql не взятое в кавычки и начинающееся с обратной косой черты, является метакомандой psql и обрабатывается самим psql. Эти команды делают psql полезным для задач администрирования и разработки скриптов.

Формат команды psql следующий: обратная косая черта, сразу за ней команда, затем аргументы. Аргументы отделяются от команды и друг от друга любым количеством пробелов.

Чтобы выйти нужно использовать клавишу с буквой Q.

Информационные ссылки

Список команд программы PSQL — https://postgrespro.ru/docs/postgresql/14/app-psql

Официальный сайт PostgreSQL — https://www.postgresql.org

Графический веб-интерфейс для управления СУБД PostgreSQL — https://www.pgadmin.org

I check

test: [ "CMD", "pg_isready", "-q", "-d", "kong", "-U", "kong" ]

Don`t have error
But have another error

docker-compose up                                                                                                                                          0.2s
[+] Running 4/3
- Network docker-compose-healthcheck_default  Created                                                                                0.0s 
- Container kong-postgres                     Created                                                                                2.8s 
- Container kong-migration                    Created                                                                                0.1s
- Container kong                              Created                                                                                0.1s 
Attaching to kong, kong-migration, kong-postgres
kong-postgres   | ********************************************************************************
kong-postgres   | WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This will allow
kong-postgres   |          anyone with access to the Postgres port to access your database without
kong-postgres   |          a password, even if POSTGRES_PASSWORD is set. See PostgreSQL
kong-postgres   |          documentation about "trust":
kong-postgres   |          https://www.postgresql.org/docs/current/auth-trust.html
kong-postgres   |          In Docker's default configuration, this is effectively any other
kong-postgres   |          container on the same system.
kong-postgres   |
kong-postgres   |          It is not recommended to use POSTGRES_HOST_AUTH_METHOD=trust. Replace
kong-postgres   |          it with "-e POSTGRES_PASSWORD=password" instead to set a password in
kong-postgres   |          "docker run".
kong-postgres   | ********************************************************************************
kong-postgres   | The files belonging to this database system will be owned by user "postgres".
kong-postgres   | This user must also own the server process.
kong-postgres   |
kong-postgres   | The database cluster will be initialized with locale "en_US.utf8".
kong-postgres   | The default database encoding has accordingly been set to "UTF8".
kong-postgres   | The default text search configuration will be set to "english".
kong-postgres   |
kong-postgres   | Data page checksums are disabled.
kong-postgres   |
kong-postgres   | fixing permissions on existing directory /var/lib/postgresql/data ... ok
kong-postgres   | creating subdirectories ... ok
kong-postgres   | selecting default max_connections ... 100
kong-postgres   | selecting default shared_buffers ... 128MB
kong-postgres   | selecting default timezone ... Etc/UTC
kong-postgres   | selecting dynamic shared memory implementation ... posix
kong-postgres   | creating configuration files ... ok
kong-postgres   | creating template1 database in /var/lib/postgresql/data/base/1 ... ok
kong-postgres   | initializing pg_authid ... ok
kong-postgres   | setting password ... ok
kong-postgres   | initializing dependencies ... ok
kong-postgres   | creating system views ... ok
kong-postgres   | loading system objects' descriptions ... ok
kong-postgres   | creating collations ... ok
kong-postgres   | creating conversions ... ok
kong-postgres   | creating dictionaries ... ok
kong-postgres   | setting privileges on built-in objects ... ok
kong-postgres   | creating information schema ... ok
kong-postgres   | loading PL/pgSQL server-side language ... ok
kong-postgres   | vacuuming database template1 ... ok
kong-postgres   | copying template1 to template0 ... ok
kong-postgres   | copying template1 to postgres ... ok
kong-postgres   | syncing data to disk ... ok
kong-postgres   |
kong-postgres   | Success. You can now start the database server using:
kong-postgres   |
kong-postgres   |     pg_ctl -D /var/lib/postgresql/data -l logfile start
kong-postgres   |
kong-postgres   |
kong-postgres   | WARNING: enabling "trust" authentication for local connections
kong-postgres   | You can change this by editing pg_hba.conf or using the option -A, or
kong-postgres   | --auth-local and --auth-host, the next time you run initdb.
kong-postgres   | waiting for server to start....LOG:  database system was shut down at 2022-02-15 04:04:37 UTC
kong-postgres   | LOG:  MultiXact member wraparound protections are now enabled
kong-postgres   | LOG:  autovacuum launcher started
kong-postgres   | LOG:  database system is ready to accept connections
kong-postgres   |  done
kong-postgres   | server started
kong-postgres   | CREATE DATABASE
kong-postgres   |
kong-postgres   |
kong-postgres   | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
kong-postgres   |
kong-postgres   | waiting for server to shut down....LOG:  received fast shutdown request
kong-postgres   | LOG:  aborting any active transactions
kong-postgres   | LOG:  autovacuum launcher shutting down
kong-postgres   | LOG:  shutting down
kong-postgres   | LOG:  database system is shut down
kong-postgres   |  done
kong-postgres   | server stopped
kong-postgres   |
kong-postgres   | PostgreSQL init process complete; ready for start up.
kong-postgres   |
kong-postgres   | LOG:  database system was shut down at 2022-02-15 04:04:38 UTC
kong-postgres   | LOG:  MultiXact member wraparound protections are now enabled
kong-postgres   | LOG:  autovacuum launcher started
kong-postgres   | LOG:  database system is ready to accept connections
kong-migration  | Bootstrapping database...
kong-migration  | migrating core on database 'kong'...
kong-migration  | core migrated up to: 000_base (executed)
kong-migration  | core migrated up to: 003_100_to_110 (executed)
kong-migration  | core migrated up to: 004_110_to_120 (executed)
kong-migration  | core migrated up to: 005_120_to_130 (executed)
kong-migration  | core migrated up to: 006_130_to_140 (executed)
kong-migration  | core migrated up to: 007_140_to_150 (executed)
kong-migration  | core migrated up to: 008_150_to_200 (executed)
kong-migration  | core migrated up to: 009_200_to_210 (executed)
kong-migration  | core migrated up to: 010_210_to_211 (executed)
kong-migration  | core migrated up to: 011_212_to_213 (executed)
kong-migration  | core migrated up to: 012_213_to_220 (executed)
kong-migration  | core migrated up to: 013_220_to_230 (executed)
kong-migration  | core migrated up to: 014_230_to_270 (executed)
kong-migration  | migrating acl on database 'kong'...
kong-migration  | acl migrated up to: 000_base_acl (executed)
kong-migration  | acl migrated up to: 002_130_to_140 (executed)
kong-migration  | acl migrated up to: 003_200_to_210 (executed)
kong-migration  | acl migrated up to: 004_212_to_213 (executed)
kong-migration  | migrating acme on database 'kong'...
kong-migration  | acme migrated up to: 000_base_acme (executed)
kong-migration  | migrating basic-auth on database 'kong'...
kong            | 2022/02/15 04:04:50 [warn] 1#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/kong/nginx.conf:6
kong            | nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/kong/nginx.conf:6
kong            | 2022/02/15 04:04:50 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:20: New migrations available; run 'kong migrations up' to proceed
kong            | stack traceback:
kong            |       [C]: in function 'error'
kong            |       /usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:20: in function 'check_state'
kong            |       /usr/local/share/lua/5.1/kong/init.lua:506: in function 'init'
kong            |       init_by_lua:3: in main chunk
kong            | nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:20: New migrations available; run 'kong migrations up' 
to proceed
kong            | stack traceback:
kong            |       [C]: in function 'error'
kong            |       /usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:20: in function 'check_state'
kong            |       /usr/local/share/lua/5.1/kong/init.lua:506: in function 'init'
kong            |       init_by_lua:3: in main chunk
kong-migration  | basic-auth migrated up to: 000_base_basic_auth (executed)
kong-migration  | basic-auth migrated up to: 002_130_to_140 (executed)
kong-migration  | basic-auth migrated up to: 003_200_to_210 (executed)
kong-migration  | migrating bot-detection on database 'kong'...
kong-migration  | bot-detection migrated up to: 001_200_to_210 (executed)
kong-migration  | migrating hmac-auth on database 'kong'...
kong-migration  | hmac-auth migrated up to: 000_base_hmac_auth (executed)
kong-migration  | hmac-auth migrated up to: 002_130_to_140 (executed)
kong-migration  | hmac-auth migrated up to: 003_200_to_210 (executed)
kong-migration  | migrating ip-restriction on database 'kong'...
kong-migration  | ip-restriction migrated up to: 001_200_to_210 (executed)
kong-migration  | migrating jwt on database 'kong'...
kong-migration  | jwt migrated up to: 000_base_jwt (executed)
kong-migration  | jwt migrated up to: 002_130_to_140 (executed)
kong-migration  | jwt migrated up to: 003_200_to_210 (executed)
kong-migration  | migrating key-auth on database 'kong'...
kong-migration  | key-auth migrated up to: 000_base_key_auth (executed)
kong-migration  | key-auth migrated up to: 002_130_to_140 (executed)
kong-migration  | key-auth migrated up to: 003_200_to_210 (executed)
kong-migration  | migrating oauth2 on database 'kong'...
kong-migration  | oauth2 migrated up to: 000_base_oauth2 (executed)
kong-migration  | oauth2 migrated up to: 003_130_to_140 (executed)
kong-migration  | oauth2 migrated up to: 004_200_to_210 (executed)
kong-migration  | oauth2 migrated up to: 005_210_to_211 (executed)
kong-migration  | migrating rate-limiting on database 'kong'...
kong-migration  | rate-limiting migrated up to: 000_base_rate_limiting (executed)
kong-migration  | rate-limiting migrated up to: 003_10_to_112 (executed)
kong-migration  | rate-limiting migrated up to: 004_200_to_210 (executed)
kong-migration  | migrating response-ratelimiting on database 'kong'...
kong-migration  | response-ratelimiting migrated up to: 000_base_response_rate_limiting (executed)
kong-migration  | migrating session on database 'kong'...
kong-migration  | session migrated up to: 000_base_session (executed)
kong-migration  | session migrated up to: 001_add_ttl_index (executed)
kong-migration  | 42 migrations processed
kong-migration  | 42 executed
kong-migration  | Database is up-to-date
kong exited with code 1
kong-migration exited with code 0
kong            | 2022/02/15 04:04:52 [warn] 1#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/kong/nginx.conf:6
kong            | nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/kong/nginx.conf:6
kong            | 2022/02/15 04:04:52 [notice] 1#0: using the "epoll" event method
kong            | 2022/02/15 04:04:52 [notice] 1#0: openresty/1.19.9.1
kong            | 2022/02/15 04:04:52 [notice] 1#0: built by gcc 10.3.1 20210424 (Alpine 10.3.1_git20210424)
kong            | 2022/02/15 04:04:52 [notice] 1#0: OS: Linux 5.10.60.1-microsoft-standard-WSL2
kong            | 2022/02/15 04:04:52 [notice] 1#0: getrlimit(RLIMIT_NOFILE): 1048576:1048576
kong            | 2022/02/15 04:04:52 [notice] 1#0: start worker processes
kong            | 2022/02/15 04:04:52 [notice] 1#0: start worker process 1098
kong            | 2022/02/15 04:04:52 [notice] 1#0: start worker process 1099
kong            | 2022/02/15 04:04:52 [notice] 1#0: start worker process 1100
kong            | 2022/02/15 04:04:52 [notice] 1#0: start worker process 1101
kong            | 2022/02/15 04:04:52 [notice] 1#0: start worker process 1102
kong            | 2022/02/15 04:04:52 [notice] 1#0: start worker process 1103
kong            | 2022/02/15 04:04:52 [notice] 1#0: start worker process 1104
kong            | 2022/02/15 04:04:52 [notice] 1#0: start worker process 1105
kong            | 2022/02/15 04:04:52 [notice] 1099#0: *3 [kong] init.lua:311 only worker #0 can manage, context: init_worker_by_lua*      
kong            | 2022/02/15 04:04:52 [notice] 1101#0: *4 [kong] init.lua:311 only worker #0 can manage, context: init_worker_by_lua*      
kong            | 2022/02/15 04:04:52 [notice] 1098#0: *1 [lua] warmup.lua:92: single_dao(): Preloading 'services' into the core_cache..., context: init_worker_by
context: init_worker_by_lua*
kong            | 2022/02/15 04:04:52 [notice] 1103#0: *5 [kong] init.lua:311 only worker #0 can manage, context: init_worker_by_lua*      
kong            | 2022/02/15 04:04:52 [notice] 1105#0: *8 [kong] init.lua:311 only worker #0 can manage, context: init_worker_by_lua*      
kong            | 2022/02/15 04:04:52 [notice] 1100#0: *2 [kong] init.lua:311 only worker #0 can manage, context: init_worker_by_lua*      
kong            | 2022/02/15 04:04:52 [notice] 1098#0: *1 [lua] warmup.lua:129: single_dao(): finished preloading 'services' into the core_cache (in 0ms), contextcache (in 0ms), context: init_worker_by_lua*
kong            | 2022/02/15 04:04:52 [notice] 1102#0: *7 [kong] init.lua:311 only worker #0 can manage, context: init_worker_by_lua*      
kong            | 2022/02/15 04:04:52 [notice] 1104#0: *6 [kong] init.lua:311 only worker #0 can manage, context: init_worker_by_lua*      
kong            | 2022/02/15 04:04:57 [crit] 1105#0: *15 [lua] balancers.lua:240: create_balancers(): failed loading initial list of upstreams: failed to get fromams: failed to get from node cache: could not acquire callback lock: timeout, context: ngx.timer
kong            | 2022/02/15 04:04:57 [crit] 1103#0: *12 [lua] balancers.lua:240: create_balancers(): failed loading initial list of upstreams: failed to get fromams: failed to get from node cache: could not acquire callback lock: timeout, context: ngx.timer
kong            | 2022/02/15 04:04:57 [crit] 1100#0: *14 [lua] balancers.lua:240: create_balancers(): failed loading initial list of upstreams: failed to get fromams: failed to get from node cache: could not acquire callback lock: timeout, context: ngx.timer
kong            | 2022/02/15 04:04:57 [crit] 1102#0: *16 [lua] balancers.lua:240: create_balancers(): failed loading initial list of upstreams: failed to get fromams: failed to get from node cache: could not acquire callback lock: timeout, context: ngx.timer
kong            | 2022/02/15 04:04:57 [crit] 1101#0: *13 [lua] balancers.lua:240: create_balancers(): failed loading initial list of upstreams: failed to get fromams: failed to get from node cache: could not acquire callback lock: timeout, context: ngx.timer
kong            | 2022/02/15 04:04:57 [crit] 1098#0: *17 [lua] balancers.lua:240: create_balancers(): failed loading initial list of upstreams: failed to get fromams: failed to get from node cache: could not acquire callback lock: timeout, context: ngx.timer
kong            | 2022/02/15 04:04:57 [crit] 1104#0: *18 [lua] balancers.lua:240: create_balancers(): failed loading initial list of upstreams: failed to get fromams: failed to get from node cache: could not acquire callback lock: timeout, context: ngx.timer

Avatar

My first attempt to install a module. In the process I’ve got an error:

socket.error: [Errno 98] Address already in use in OpenERP

Tried to solve like this:

ps aux | grep openerp 
sudo kill -9 procees id
sudo /etc/init.d/openerp-server restart (=> this doesn't work)

Now I get an other error OperationalError: FATAL: role «root» does not exist and the website is down.

Can someone help me out? 

6Ответы

 500 internal server error (Linux)

OperationalError: FATAL: role «root» does not exist

You find this error in file : /var/log/postgrsql/postgrsql-10-main.log (on linux system)

The solution may be :

    1- Open Terminal and enter => sudo su postgres
    2- Enter password for postgres System user (if it is necessary)
    3- createuser root -s
    4- psql template1
    5- alter role root with password ‘yourpassword’;
    6- q
    7- exit
    8- service odoo restart

Now try again to localhost:8069

Dennis,

You have to create user role for postgres.

sudo -u postgres createuser -s username
sudo su postgres
psql
alter user username with password 'password';
q
exit

me pueden  ayudarme para darle permiso para ingresar odoo 

Thank you so much, it worked for me 

Thanks so much, it work, this fix my problem. 

Thanks so much, it works for me too, I solved my problem using this command. 

Используйте пользователя postgres операционной системы для создания вашей базы данных — если вы не настроили роль базы данных с необходимыми привилегиями, соответствующими пользователю вашей операционной системы с таким же именем (h9uest в вашем случае):

sudo -u postgres -i

Как рекомендуется здесь или здесь.

Тогда попробуйте еще раз. Напечатайте exit когда закончите с работой как системный пользователь postgres.

Или выполните одну команду createuser как postgres с sudo, как продемонстрировано drees в другом ответе.

Смысл заключается в том, чтобы использовать пользователя операционной системы, совпадающего с ролью базы данных с тем же именем, для предоставления доступа через ident аутентификацию. postgres — это пользователь операционной системы по умолчанию, который инициализировал кластер базы данных. Руководство:

Для начальной загрузки системы базы данных, недавно инициализированная система всегда содержит одну предопределенную роль. Эта роль всегда является «суперпользователем», и по умолчанию (если она не изменена при запуске initdb) она будет иметь то же имя, что и пользователь операционной системы, который инициализировал кластер базы данных. Обычно эта роль будет называться postgres. Чтобы создать больше ролей, сначала необходимо подключиться к этой начальной роли.

Я слышал о странных установках с нестандартными именами пользователей или о том, где пользователь операционной системы не существует. Вам нужно будет адаптировать свою стратегию там.

Читайте о ролях базы данных и аутентификации клиента в руководстве.

Я настраиваю свой PostgreSQL 9.1. Я не могу ничего сделать с PostgreSQL: не могу createdb, не может createuser; все операции возвращают сообщение об ошибке

Fatal: role h9uest does not exist

h9uest — мое имя учетной записи, а я sudo apt-get install PostgreSQL 9.1 в этой учетной записи.
Аналогичная ошибка сохраняется для учетной записи root.

4b9b3361

Ответ 1

Используйте postgres пользователя операционной системы для создания вашей базы данных — если вы не настроили роль базы данных с необходимыми привилегиями, соответствующими пользователю вашей операционной системы с таким же именем (h9uest в вашем случае):

sudo -u postgres -i

Как рекомендуется здесь или здесь.

Тогда попробуйте еще раз. Напечатайте exit когда закончите с работой как системный пользователь postgres

Или выполните одну команду createuser как postgres с sudo, как продемонстрировано drees в другом ответе.

Смысл заключается в том, чтобы использовать пользователя операционной системы, совпадающего с ролью базы данных с тем же именем, для предоставления доступа через ident аутентификацию. postgres — это пользователь операционной системы по умолчанию, который инициализировал кластер базы данных. Руководство:

Для начальной загрузки системы базы данных, недавно инициализированная система всегда содержит одну предопределенную роль. Эта роль всегда является «суперпользователем», и по умолчанию (если она не изменена при запуске initdb) она будет иметь то же имя, что и пользователь операционной системы, который инициализировал кластер базы данных. Обычно эта роль будет называться postgres. Чтобы создать больше ролей, сначала необходимо подключиться к этой начальной роли.

Я слышал о странных настройках с нестандартными именами пользователей или о том, где пользователь операционной системы не существует. Вам нужно будет адаптировать свою стратегию там.

Читайте о ролях базы данных и аутентификации клиента в руководстве.

Ответ 2

После попытки решения многих других народов и без успеха этот ответ, наконец, помог мне.

fooobar.com/questions/13172/…

Короче говоря, работая

sudo -u postgres createuser owning_user

создает роль с именем owning_user (в данном случае h9uest). После этого вы можете запустить rake db:create из терминала под любым именем учетной записи, которое вы создали, без необходимости входить в среду postgres.

Ответ 3

sudo su - postgres

psql template1

создание роли на pgsql с привилегией как «суперпользователь»

CREATE ROLE username superuser;
eg. CREATE ROLE demo superuser;

Затем создайте пользователя

CREATE USER username; 
eg. CREATE USER demo;

Назначить пользователю привилегию

GRANT ROOT TO username;

И затем включите логин этого пользователя, так что вы можете запустить, например: psql template1, с обычного терминала $:

ALTER ROLE username WITH LOGIN;

Ответ 4

Установка postgres с помощью apt-get не создает роль пользователя или базу данных.

Чтобы создать роль суперпользователя и базу данных для вашей личной учетной записи пользователя:

sudo -u postgres createuser -s $(whoami); createdb $(whoami)

Ответ 5

Это работает для меня:

psql -h localhost -U postgres

Ответ 6

Рабочий метод,

  • vi /etc/postgresql/9.3/main/pg_hba.conf
  • local all postgres peer
    здесь измените равноправный на доверие
  • перезагрузка, sudo service postgresql restart

  • теперь попробуйте, psql -U postgres

Ответ 7

Я установил его на macOS и должен был:

cd /Applications/Postgres.app/Contents/Versions/9.5/bin
createuser -U postgres -s YOURUSERNAME
createdb YOURUSERNAME

Вот источник: https://github.com/PostgresApp/PostgresApp/issues/313#issuecomment-192461641

Ответ 8

В приглашении локального пользователя, а не в командной строке пользователя root, введите

sudo -u postgres createuser <local username>

Затем введите пароль для локального пользователя.

Затем введите предыдущую команду, в которой генерируется «имя пользователя» роли. «

Выше шаги решили проблему для меня.
Если нет, отправьте сообщения о терминалах для вышеуказанных шагов.

Ответ 9

Для версии Postgres 9.5 используйте следующую команду:

psql -h localhost -U postgres

Надеюсь, это поможет.

Ответ 10

Создание кластера БД вручную решило проблему в моем случае.

По какой-то причине, когда я установил postgres, «исходная БД» не была создана. Выполнение initdb мне.

Это решение представлено в PostgreSQL Wiki — Первые шаги:

initdb

Обычно установка postgres в вашей ОС создает «начальную БД» и запускает демон сервера postgres. Если нет, то вам нужно запустить initdb

Ответ 11

Следуйте этим шагам, и это сработает для вас:

  • run msfconsole
  • Тип db_console
  • Некоторая информация будет показана вам, вы выбрали информацию, которая говорит вам сделать: db_connect user:[email protected]:port.../database извините, я не помню, но он как этот, затем заменяет пользователя и пароль, а также хост и базу данных информацией включен в database.yml в пространстве: /usr/share/metasploit-framework/config
  • вы увидите. пересоздание кэша модели в фоновом режиме.
  • Введите apt-get update && & & apt-get upgrade после обновления перезапустите терминал и обеденный msfconsole, и он работает, вы можете проверить, что, введя msfconsole: msf>db_status, вы увидите, что он подключен.

Ответ 12

psql postgres

postgres=# CREATE ROLE username superuser;
postgres=# ALTER ROLE username WITH LOGIN;

Ответ 13

Для пользователей Windows: psql -U postgres

Вы должны увидеть интерфейс командной строки для PostgreSQL: postgres=#

Ответ 14

сбросить и восстановить с помощью --no-owner --no-privileges flags

например

dump — pg_dump --no-owner --no-privileges --format=c --dbname=postgres://userpass:[email protected]:5432/schemaname >/tmp/full.dump

restore — pg_restore --no-owner --no-privileges --format=c --dbname=postgres://userpass:[email protected]:5432/schemaname/tmp/full.dump

Ответ 15

Удаление всего и сохранение Postgres.app:

brew cask uninstall postgres
brew uninstall postgres
brew cask install postgres
rm -rf /Applications/Postgres93.app/
# shutdown any postgres instance
# open postgres.app -> "Initialize"

Мне нужен PostgreSQL 9.6

  • Psp ошибка чтения umd
  • Psp ошибка форматирования 8022008b
  • Psp ошибка подключения таймаут подключения ip адреса
  • Psp vita ошибка c1 6775 5
  • Psn произошла ошибка 80023102