See git gist with instructions here
Run this:
sudo -u postgres psql
OR
psql -U postgres
in your terminal to get into postgres
NB: If you’re on a Mac and both of the commands above failed jump to the section about Mac below
postgres=#
Run
CREATE USER new_username;
Note: Replace new_username with the user you want to create, in your case that will be tom.
postgres=# CREATE USER new_username;
CREATE ROLE
Since you want that user to be able to create a DB, you need to alter the role to superuser
postgres=# ALTER USER new_username SUPERUSER CREATEDB;
ALTER ROLE
To confirm, everything was successful,
postgres=# du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
new_username | Superuser, Create DB | {}
postgres | Superuser, Create role, Create DB, Replication | {}
root | Superuser, Create role, Create DB | {}
postgres=#
Update/Modification (For Mac):
I recently encountered a similar error on my Mac:
psql: FATAL: role "postgres" does not exist
This was because my installation was setup with a database superuser whose role name is the same as your login (short) name.
But some linux scripts assume the superuser has the traditional role name of postgres
How did I resolve this?
If you installed with homebrew
run:
/usr/local/opt/postgres/bin/createuser -s postgres
If you’re using a specific version of postgres, say
10.5
then run:
/usr/local/Cellar/postgresql/10.5/bin/createuser -s postgres
OR:
/usr/local/Cellar/postgresql/10.5/bin/createuser -s new_username
OR:
/usr/local/opt/postgresql@11/bin/createuser -s postgres
If you installed with
postgres.app
for Mac run:
/Applications/Postgres.app/Contents/Versions/10.5/bin/createuser -s postgres
P.S: replace 10.5 with your PostgreSQL version
Here’s a question from one of our regular reader Sam. He says that PostgreSQL does not allow to create user or database and fails with an error message “Createuser could not connect to database postgres” while issuing createuser
command and “createdb: could not connect to database template1” while executing createdb
command. The command fails when executed as privileged user as well. Here’s the solution for this error.
Before we see the solution, have a look at the error message:
[sam@openca ]$ createdb openca createdb: could not connect to database template1: FATAL: role "sam" does not exist [sam@openca ]$ su - [root@ra openca ]# createuser openca createuser: could not connect to database postgres: FATAL: role "root" does not exist
How to fix the error – createuser could not connect to database postgres
According to the snapshot, createuser
and createdb
commands were executed as ‘sam’ and ‘root’ user. It means, the PostgreSQL administrator has not created a PostgreSQL user account for ‘sam’ & ‘root’. Note, the PostgreSQL user accounts are different from the regular UNIX user accounts. So, even if you have valid UNIX accounts, it’s not a valid PostgreSQL user account until administrator creates one. That’s the reason, PostgreSQL denied users ‘sam’ & ‘root’ from creating user or database. In order to fix this error, you need to switch to a user that’s running PostgreSQL server. By default, UNIX user 'postgres'
is the one that will be running PostgreSQL server. So the createdb
& createuser
commands should be executed as 'postgres'
user account as shown below.
$ sudo su - postgres
(or)
$ sudo -u postgres -i
You can now create database as ‘postgres’ user as shown below:
$ createdb openca
Create PostgreSQL user account as below:
$ createuser sam
Verify, if PostgreSQL user is created properly by logging-in to ‘sam’ user and type psql
as shown below.
# sudo su - sam [sam@openca ]$ psql psql (9.2.23) Type "help" for help. postgres=# q
That’s it!
Note:
You don’t require to enter password if the PostgreSQL allows ident
based authentication.
How to allow users to create PostgreSQL database?
By default, PostgreSQL does not allow users to create or drop database. If you ever want to allow users to create PostgreSQL database, then the administrator has to provide necessary privileges.
To do that, switch to the user that is running PostgreSQL server.
$ sudo su - postgres
Type psql
to enter PostgreSQL prompt.
$ psql psql (9.2.23) Type "help" for help. postgres=#
Grant CREATEDB
privilege using ALTER
statement as shown below:
postgres=# ALTER USER sam CREATEDB; ALTER ROLE
Note:
Replace ‘sam’ with the user account you wish to grant privilege.
Test if user ‘sam’ has enough privileges to create a database.
[sam@openca ]$ createdb test [sam@openca ]$ psql -d test psql (9.2.23) Type "help" for help. test=>
In case, if you don’t have privilege to create database in PostgreSQL, then you will see an error as shown below:
# createdb createdb: could not connect to database template1: FATAL: role "sam" does not exist
причины проблемы
Postgresql не может использовать пользователя root для запуска службы, поэтому вы должны переключиться на другого пользователя, чтобы запустить обычную службу, но иногда нам нужно использовать пользователя root для использования postgresql
Решение
метод первый
Не используйте postgresql как пользователь root без необходимости
Метод второй
Вручную создайте корневую роль, здесь я использую имя пользователя postgres для запуска службы postgresql
su postgres
# Создать пользователя root
postgres=#create user root with password 'password';
CREATE ROLE
# Предоставить права доступа к базе данных пользователю root
postgres=# GRANT ALL PRIVILEGES ON DATABASE mydatabase to root;
GRANT
# Измените пользователя на суперпользователя (см. Фактические потребности)
postgres=# ALTER ROLE root WITH SUPERUSER;
postgres=# q
Вы также можете напрямую создать root как суперпользователь, вход в систему означает разрешение входа в систему
CREATE ROLE root superuser PASSWORD 'password' login;
0 / 0 / 0 Регистрация: 16.09.2012 Сообщений: 4 |
|
1 |
|
16.09.2012, 17:41. Показов 29899. Ответов 7
Здравствуйте, имею Ubuntu 12.04, установил туда PSQL 9.1. В системе есть только одна учётная запись alexander. Не могу создать базу данных: получаю сообщение:
__________________
0 |
Programming Эксперт 94731 / 64177 / 26122 Регистрация: 12.04.2006 Сообщений: 116,782 |
16.09.2012, 17:41 |
Ответы с готовыми решениями: Начало работы в С++ Начало работы с Qt Начало Работы 1)Хорошую инструкцию по установке, И вообще что мне устанавливать для создния… Начало работы в qt 7 |
4087 / 3821 / 745 Регистрация: 18.05.2010 Сообщений: 9,331 Записей в блоге: 11 |
|
17.09.2012, 14:18 |
2 |
Выдержка из документации Another response could be this: createdb: could not connect to database postgres: FATAL: role «joe» does not exist where your own login name is mentioned. This will happen if the administrator has not created a PostgreSQL user account for you. (PostgreSQL user accounts are distinct from operating system user accounts.) If you are the administrator, see Chapter 19 for help creating accounts. You will need to become the operating system user under which PostgreSQL was installed (usually postgres) to create the first user account. It could also be that you were assigned a PostgreSQL user name that is different from your operating system user name; in that case you need to use the -U switch or set the PGUSER environment variable to specify your PostgreSQL user name.
0 |
0 / 0 / 0 Регистрация: 16.09.2012 Сообщений: 4 |
|
17.09.2012, 15:51 [ТС] |
3 |
Я так понял, что нужно подключиться к начальной роли postgres. Как это сделать? Когда я пытаюсь создать новую роль от имени postgres, получаю сообщение, что peer authentication has failed.
0 |
17 / 17 / 0 Регистрация: 19.02.2012 Сообщений: 68 |
|
21.09.2012, 12:41 |
4 |
Пробуем запустить консоль PostgreSQL: $ psql После неудачных попыток делаем следующее: vladimir@rubydev:~$ sudo su postgres Источник: http://rubydev.ru/2012/03/inst… ntu_linux/ Авось поможет…
1 |
0 / 0 / 0 Регистрация: 16.09.2012 Сообщений: 4 |
|
21.09.2012, 16:55 [ТС] |
5 |
Сделал, как Вы сказали, — получился вход в консоль PSQL. Какую команду ни ввожу, реакции нету, даже help вводил — нет реакции, просто вновь выводится приглашение postgres=# с новой строки. Пробовал в Windows XP установить PSQL — там тоже в консоли нет реакции на команды.
0 |
17 / 17 / 0 Регистрация: 19.02.2012 Сообщений: 68 |
|
21.09.2012, 17:03 |
6 |
Сделал, как Вы сказали, — получился вход в консоль PSQL. Какую команду ни ввожу, реакции нету, даже help вводил — нет реакции, просто вновь выводится приглашение postgres=# с новой строки. Пробовал в Windows XP установить PSQL — там тоже в консоли нет реакции на команды. Если мне не изменяет память (долбанный склероз), то psql воспринимает команду только в случае если в конце строки стоит разделитель «;». Иначе он считает что команда еще не завершена и не выполняет ее. Добавлено через 3 минуты
2 |
0 / 0 / 0 Регистрация: 16.09.2012 Сообщений: 4 |
|
22.09.2012, 00:06 [ТС] |
7 |
У меня долг по одному предмету, мне нужна БД на PSQL.
0 |
17 / 17 / 0 Регистрация: 19.02.2012 Сообщений: 68 |
|
23.09.2012, 17:41 |
8 |
Я правильно понимаю: su имя — подключение к указанной учётной записи? Да, подключение к учетной записи…
0 |
IT_Exp Эксперт 87844 / 49110 / 22898 Регистрация: 17.06.2006 Сообщений: 92,604 |
23.09.2012, 17:41 |
Помогаю со студенческими работами здесь Начало работы Начало работы с ПО С++ Начало работы 1с начало работы Искать еще темы с ответами Или воспользуйтесь поиском по форуму: 8 |
This article is half-done without your Comment! *** Please share your thoughts via Comment ***
A PostgreSQL Fatal error like role or username does not exist. This is a very common error which is facing by PostgreSQL Users.
Actually, this is happening because of misconfiguration of System username and Database Username.
Most of the Linux users are trying to log in PostgreSQL using root user. But actually, this is wrong.
You will need to become the operating system user under which PostgreSQL was installed to create the first user account.
Generally, the default user name is Postgres and default database is also Postgres.
Once you install PostgreSQL on Linux, you should set the password for the Postgres user which is the default super user of PostgreSQL.
Please do not try to log in with any other default Linux or Unix system user name.
Set password for the default Postgres user:
Create another role using “postgres”:
Creating new role “dbrnd”. -p = set the password and -d = allow to create database.
sudo -u postgres createuser dbrnd -d -P |
PostgreSQL: How to Install PostgreSQL 9.4 on Ubuntu 14.04?
PostgreSQL: How to Install PostgreSQL 9.6 on Ubuntu 16.04?
Jan 23, 2017
Используйте пользователя postgres
операционной системы для создания вашей базы данных — если вы не настроили роль базы данных с необходимыми привилегиями, соответствующими пользователю вашей операционной системы с таким же именем (h9uest
в вашем случае):
sudo -u postgres -i
Как рекомендуется здесь или здесь.
Тогда попробуйте еще раз. Напечатайте exit
когда закончите с работой как системный пользователь postgres
.
Или выполните одну команду createuser
как postgres
с sudo
, как продемонстрировано drees в другом ответе.
Смысл заключается в том, чтобы использовать пользователя операционной системы, совпадающего с ролью базы данных с тем же именем, для предоставления доступа через ident
аутентификацию. postgres
— это пользователь операционной системы по умолчанию, который инициализировал кластер базы данных. Руководство:
Для начальной загрузки системы базы данных, недавно инициализированная система всегда содержит одну предопределенную роль. Эта роль всегда является «суперпользователем», и по умолчанию (если она не изменена при запуске
initdb
) она будет иметь то же имя, что и пользователь операционной системы, который инициализировал кластер базы данных. Обычно эта роль будет называтьсяpostgres
. Чтобы создать больше ролей, сначала необходимо подключиться к этой начальной роли.
Я слышал о странных установках с нестандартными именами пользователей или о том, где пользователь операционной системы не существует. Вам нужно будет адаптировать свою стратегию там.
Читайте о ролях базы данных и аутентификации клиента в руководстве.
See git gist with instructions here
Run this:
sudo -u postgres psql
OR
psql -U postgres
in your terminal to get into postgres
NB: If you’re on a Mac and both of the commands above failed jump to the section about Mac below
postgres=#
Run
CREATE USER new_username;
Note: Replace new_username with the user you want to create, in your case that will be tom.
postgres=# CREATE USER new_username;
CREATE ROLE
Since you want that user to be able to create a DB, you need to alter the role to superuser
postgres=# ALTER USER new_username SUPERUSER CREATEDB;
ALTER ROLE
To confirm, everything was successful,
postgres=# du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
new_username | Superuser, Create DB | {}
postgres | Superuser, Create role, Create DB, Replication | {}
root | Superuser, Create role, Create DB | {}
postgres=#
Update/Modification (For Mac):
I recently encountered a similar error on my Mac:
psql: FATAL: role "postgres" does not exist
This was because my installation was setup with a database superuser whose role name is the same as your login (short) name.
But some linux scripts assume the superuser has the traditional role name of postgres
How did I resolve this?
If you installed with homebrew
run:
/usr/local/opt/postgres/bin/createuser -s postgres
If you’re using a specific version of postgres, say
10.5
then run:
/usr/local/Cellar/postgresql/10.5/bin/createuser -s postgres
OR:
/usr/local/Cellar/postgresql/10.5/bin/createuser -s new_username
OR:
/usr/local/opt/[email protected]/bin/createuser -s postgres
If you installed with
postgres.app
for Mac run:
/Applications/Postgres.app/Contents/Versions/10.5/bin/createuser -s postgres
P.S: replace 10.5 with your PostgreSQL version
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
Posted by: , July 7, 2014
Question:
Create postgres database
# createdb mydb
response could be like this:
createdb: could not connect to database postgres: FATAL: role "root" does not exist
createdb: could not connect to database template1: FATAL: role "root" does not exist
where your own login name is mentioned. This will happen if the administrator has not created a PostgreSQL user account for you. (PostgreSQL user accounts are distinct from operating system user accounts.) If you are the administrator, see Chapter 20 for help creating accounts. You will need to become the operating system user under which PostgreSQL was installed (usually postgres) to create the first user account. It could also be that you were assigned a PostgreSQL user name that is different from your operating system user name; in that case you need to use the -U switch or set the PGUSER environment variable to specify your PostgreSQL user name.
# createdb mydb -U postgres
response could be like this:
createdb: database creation failed: ERROR: permission denied to create database
Not every user has authorization to create new databases. If PostgreSQL refuses to create databases for you then the site administrator needs to grant you permission to create databases. Consult your site administrator if this occurs. If you installed PostgreSQL yourself then you should log in for the purposes of this tutorial under the user account that you started the server as.
You can also create databases with other names. PostgreSQL allows you to create any number of databases at a given site. Database names must have an alphabetic first character and are limited to 63 bytes in length. A convenient choice is to create a database with the same name as your current user name. Many tools assume that database name as the default, so it can save you some typing.
How to Fix :
Step 1: edit pg_hba.conf file
# sudo nano /etc/postgresql/9.3/main/pg_hba.conf
Step 2 : change ” peer ” to pcDuino Ubuntu user , such as ” root “
Look at :
# Database administrative login by Unix domain socket local all postgres peer
Change to :
# Database administrative login by Unix domain socket local all postgres trust
Step 3: save ” pg_hba.conf “file and reload PostgreSQL service
# sudo /etc/init.d/postgresql reload
Step 4: createdb successfully
# createdb mydb -U postgres