How do I connect to MYSQL Docker from my Mac?

  docker, docker-compose, mariadb

I’m going in circles trying to figure this out!

I have a remote Mac running Docker v3.5.2 and a Maria DB container.

I’d like to access the database from another Mac on my network, but I cant work it out!

I can connect just fine from the host Mac itself.

Here’s my docker-compose.yml:

services:
  db:
    restart: always
    image: mariadb:latest
    container_name: MARIADB
    ports:
      - 3306:3306
    volumes:
      - ./init:/docker-entrypoint-initdb.d
    environment:
      MYSQL_ROOT_PASSWORD: root
      BIND_ADDRESS: 0.0.0.0

I’ve also granted all privileges to the root user.

I have a file:

#/init/01.sql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';

I always get the error:

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

Any ideas! I’m going bonkers trying to figure out how to set this up! 🙂

Source: Docker Questions

LEAVE A COMMENT