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 Answer 1

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.

1
  • I think the issue was that a lot of these images didn't let you log in via the console. Oddly over a JDBC connection within my node applicaiton it worked sometimes ( but I canÄt import things from there). Luckily I found a image that works: woahbase/alpine-mysql:armv7l Commented Feb 14, 2020 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.