pedrommuller
pedrommuller

Reputation: 16066

Access denied for user 'user=bn_moodle'@'localhost' (using password: NO)

I'm getting this error from a MariaDB database inside a docker image, the docker image I'm using this Moodle image and starting up the instances using docker-compose up.

I just want to restore a dump in the docker database, I'm following this thread and I'm testing this command:

docker exec -i mysql-container mysql -uuser -ppassword name_db < data.sql

the docker-compose.yml is the following:

version: '2'
services:
  mariadb:
    image: 'bitnami/mariadb:latest'
    environment:
      - MARIADB_USER=bn_moodle
      - MARIADB_DATABASE=bitnami_moodle
      - ALLOW_EMPTY_PASSWORD=yes
    volumes:
      - 'mariadb_data:/bitnami'
  moodle:
    image: 'bitnami/moodle:3'
    environment:
      - MARIADB_HOST=mariadb
      - MARIADB_PORT_NUMBER=3306
      - MOODLE_DATABASE_USER=bn_moodle
      - MOODLE_DATABASE_NAME=bitnami_moodle
      - ALLOW_EMPTY_PASSWORD=yes
    ports:
      - '80:80'
      - '443:443'
    volumes:
      - 'moodle_data:/bitnami'
    depends_on:
      - mariadb
volumes:
  mariadb_data:
    driver: local
  moodle_data:
    driver: local

So I'm doing this:

docker exec -i docker-instance-id mysql -uuser=bn_moodle bitnami_moodle < Dump20190402.sql 

since I don't see any user password in the yaml file, I'm not passing it, assuming I can log in to the database with no password.

but I'm getting this error:

Access denied for user 'user=bn_moodle'@'localhost' (using password: NO)

Any advice will be appreciated it! thanks

Upvotes: 0

Views: 1313

Answers (1)

Esteban Garcia
Esteban Garcia

Reputation: 2283

You have a typo in your exec command. It should be --user=bn_moodle or -u bn_moodle not --uuser

docker exec -i docker-instance-id mysql --user=bn_moodle bitnami_moodle < Dump20190402.sql 

Upvotes: 1

Related Questions