1

I've tried countless docker images, but all of them have the same behaviour.

When I open up a console and try to import my database structure via the mysql/mariadb command. But I always get the same error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

This is my dockerfile:

version: '3'

networks:
    mynet:
        driver: bridge

services:
  mariadb:
    container_name: mariadb
    image: webhippie/mariadb # this one doesn't work (at least for me)
    networks:
        mynet:
            aliases:
                - database
    environment:
        - MARIADB_ROOT_PASSWORD=topsecret
        - MARADB_DATABASE=mydb
    ports:
    - 3306:3306

Do you have any suggestions on how I can login via the console?

1 Answers1

1

Does the following work?

docker-compose exec mariadb /usr/bin/mysql -u <your_db_username> --password=<your_db_password> < your_db_backup.sql

Note: mariadb is the name of your container.

Edit: I realize I'm using docker-compose. So I'm not entirely sure if this would work with just a Dockerfile.

Argyle
  • 1,026
  • 2
  • 9
  • 20