'invalid credentials for user 'monetdb' when using the official docker image and a .monetdb file

How to recreate my problem

Creating the MonetDB Container

I have this setup (using windows with Docker Desktop).

Create the official monetdb docker container with the follwing command:

docker run -v $HOME/Desktop/monetdbtest:/monetdbtest -e 'MONET_DATABASE=docker' -e 'MONETDB_PASSWORD=docker' -p 50000:50000 -d topaztechnology/monetdb:latest

explanation what the command does: creates a monetdb container with a database called 'docker' and applies the password 'docker' to the default user called 'monetdb'. It also mounts my directory monetdbtest/ into the container.

Testing the container with DBeaver

I test the connection using DBeaver with the following credentials:

JDBC URL: jdbc:monetdb://localhost:50000/docker
host: localhost
port: 50000
Database/schema: docker
username: monetdb
password: docker

this works fine, i am able to connect and can exequte sql queries with dbeaver.

Using mclient within the container to send queries

I enter the container as root with the following command: docker exec -u root -t -i nostalgic_hodgkin /bin/bash (replace nostalgic_hodgkin with your randomly generated container name)

2. I navigate to my mounted directory

cd monetdbtest

then I test the connection with mclient:

mclient -h localhost -p 50000 -d docker

I get asked for user and password, so for user I enter monetdb and for password I enter docker. It works and I am in the mclient shell, able to execute SQL queries.

3. Since I don't want to always enter username and password I create a .monetdb file in the monetdbtest/ directory. It looks like this:

user=monetdb
password=docker
  1. Now I should be able to use the mclient command without entering user information. So I type this command:
mclient -h localhost -p 50000 -d docker

However I get the message: 'nvalidCredentialsException:checkCredentials:invalid credentials for user 'monetdb


I did everything according to the mclient manual. Maybe I missed something?



Solution 1:[1]

You may need to export the environment variable DOTMONETDBFILE with value /monetdbtest/.monetdb. See the man page for mclient, especially the paragraph before the OPTIONS heading.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sjoerd Mullender