Connection to MariaDb within docker container and mysql workbench

Viewed 180

I created a docker container that's running MariaDb using the command below:

docker run -d --name some-mariadb -p 3306:3306 -e MARIADB_USER=example-user -e MARIADB_PASSWORD=<enter password> -e MARIADB_ROOT_PASSWORD=<enter password>  mariadb 

I'm not able to successfully test the connection in mysql workbench when putting in the IPAddress (found it by running the docker command below) along with the user (example-user) and password (tried the passwords for MARIDB_PASSWORD and MARIADB_ROOT_PASSWORD).

All I get is "unable to connect to host"

Docker command to get IPAddress:

docker container inspect some-mariadb

Note that when I run the command below I am able to see the MariaDB [(none)]> terminal.

docker exec -it some-mariadb mysql -u example-user -p
1 Answers

I was able to create a connection using the localhost (127.0.0.1) IP address. The user and MARIADB_ROOT_PASSWORD had no issue.

Related