Skip to content

authentication error when connecting to db #1

@glw

Description

@glw

Hi I was just used your example to start up the db.

docker run -d -p 5432:5432
-e "PG_USER=user"
-e "PG_PASSWORD=mypass"
-e "DB_NAME=mydb"
--restart=unless-stopped
--volume=/docker_postgres/cityseer_postgresql11:/postgresql/11/main
cityseer/postgis:latest

And tried to make a basic connection with:
pgcli postgresql://user:mypass@localhost:5432/mydb

error:
FATAL: password authentication failed for user "user"

I would just like to work with the db locally. Am I doing something wrong?

Here is the output for docker log -f

allexport      	off
braceexpand    	on
emacs          	off
errexit        	on
errtrace       	off
functrace      	off
hashall        	on
histexpand     	off
history        	off
ignoreeof      	off
interactive-comments	on
keyword        	off
monitor        	off
noclobber      	off
noexec         	off
noglob         	off
nolog          	off
notify         	off
nounset        	off
onecmd         	off
physical       	off
pipefail       	off
posix          	off
privileged     	off
verbose        	off
vi             	off
xtrace         	off
No postgres config file found in folder. Attempting to create database.
Present data path directory contents. Note that if this folder is not empty, then an error will be returned.
Setting permissions on folders
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_GB.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /postgresql/11/main ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Etc/UTC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/lib/postgresql/11/bin/pg_ctl -D /postgresql/11/main -l logfile start

waiting for server to start....2020-02-14 22:54:56.781 UTC [38] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2020-02-14 22:54:56.782 UTC [38] LOG:  could not bind IPv6 address "::1": Cannot assign requested address
2020-02-14 22:54:56.782 UTC [38] HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2020-02-14 22:54:56.787 UTC [38] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-02-14 22:54:56.802 UTC [39] LOG:  database system was shut down at 2020-02-14 22:54:55 UTC
2020-02-14 22:54:56.883 UTC [38] LOG:  database system is ready to accept connections
 done
server started
NOTE -> Using supplied PG_USER value: user
NOTE -> Using supplied DB_NAME value: mydb
NOTE -> Using supplied PG_PASSWORD value: mypass for 'postgres' and 'user' users
ALTER ROLE
2020-02-14 22:54:57.003 UTC [61] ERROR:  syntax error at or near "user" at character 13
2020-02-14 22:54:57.003 UTC [61] STATEMENT:  CREATE ROLE user LOGIN PASSWORD 'mypass';
ERROR:  syntax error at or near "user"
LINE 1: CREATE ROLE user LOGIN PASSWORD 'mypass';
                    ^

There seems to be an issue when creating the new role.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions