Answers: <p>Does the following work?</p>
  
  <pre><code>docker-compose exec mariadb /usr/bin/mysql -u &lt;your_db_username&gt; --password=&lt;your_db_password&gt; &lt; your_db_backup.sql
  </code></pre>
  
  <p>Note: <code>mariadb</code> is the name of your container.</p>
  
  <p>Edit: I realize I'm using docker-compose. So I'm not entirely sure if this would work with just a Dockerfile.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-02-14T16:03:07.750Z
Answers: 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
Answers: Cowboy_Patrick
Answers: CC BY-SA 4.0
Answers: 2020-02-14T15:32:03.947Z
Answers: 2020-02-14T15:32:03.947Z
Answers: Argyle
Body: <p>I've tried countless docker images, but all of them have the same behaviour.</p>
  
  <p>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:</p>
  
  <pre><code>ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
  </code></pre>
  
  <p>This is my dockerfile:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Do you have any suggestions on how I can login via the console?</p>
  
Tags: <docker><docker-compose><mysql>
Title: mariadb docker on raspberry
UserDisplayName: Cowboy_Patrick
ThreadText: # mariadb docker on raspberry
  
  (Asked by: username_0 on 2020-02-13)
  
  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?
  
  **Tags:** docker, docker-compose, mysql
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-02-14. Score: 1 | Accepted answer
  
  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.
  
  > **Comments:**
  > **username_0**: 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  
  
  ---
  
  