Remote mysql docker access

How can i access mysql/mariadb in docker installatiom production mode

docker exec -it <mariadb-container-name> bash

Then enter into Mariadb shell using root password

mysql -uroot -p

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2 “No such file or directory”)

i got this error

Are you inside the container?

ok i managed to access the mysql in SSH, but i want to access the tables with mysql workbench, how do i change bind adress to bind_address = 0.0.0.0 so i can access the database public

publish port 3306 in the docker-compose.yml file where mariadb service is created.

services:
  ...
  mariadb:
    ...
    ports:
      - 3306:3306

Once that is done, you can access mariadb on docker host on port 3306

Where can i find the folder for that file thanks

I don’t know.

there are multiple places.

If you used the single bench then it’s in the frappe_docker/docker-compose.yml file

If you used multi bench then it’s in frappe_docker/installation/docker-compose-common.yml

>  mariadb:
>     image: mariadb:10.3
>     restart: on-failure
>     environment:
>       - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
>     volumes:
>       - ./installation/frappe-mariadb.cnf:/etc/mysql/conf.d/frappe.cnf
>       - mariadb-vol:/var/lib/mysql

Will i publish it in this area ?

Yes.

docker-compose docs https://docs.docker.com/compose/compose-file/compose-file-v3/#ports

mariadb:
    image: mariadb:10.3
    restart: on-failure
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
    volumes:
      - ./installation/frappe-mariadb.cnf:/etc/mysql/conf.d/frappe.cnf
      - mariadb-vol:/var/lib/mysql
 services:
  ...
  mariadb:
    ...
    ports:
      - 3306:3306

Can you check if this right ?

I fear I can’t help you.

mariadb:
    image: mariadb:10.3
    restart: on-failure
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
    volumes:
      - ./installation/frappe-mariadb.cnf:/etc/mysql/conf.d/frappe.cnf
      - mariadb-vol:/var/lib/mysql
    ports:
      - 3306:3306

You haven’t even mentioned Linux, Windows or Mac,
By looking at your cli I think you must use Windows or Mac. I don’t use windows

Ok i think i got right now, will i need to restart the server ? or

docker ps

this should show the running containers and the published ports.

I found this by searching, check if it helps, Connecting MariaDB docker instance from MySQL workbench

Thanks it worked :slight_smile: