Small Traps in Setting a Local MariaDB Development Environment by Docker

docker pull mariadb
docker run --name=learning-mariadb mariadb
docker run --name=learning-mariadb-server --env="MYSQL_ROOT_PASSWORD=your-password" mariadb
docker container rm learning-mariadb-server
docker run -it --network some-network --rm mariadb mysql -hsome-mariadb -uexample-user -p
docker network create learning-mariadb-network
docker run --name=learning-mariadb-server\
--detach \
--env="MYSQL_ROOT_PASSWORD=your-password" \
--network learning-mariadb-network \
mariadb
docker run -it --rm \
--name=learning-mariadb-client \
--network learning-mariadb-network \
mariadb \
mysql -u root -h learning-mariadb-server -p
mysql -u root -h learning-mariadb-server -p
-u root -h learning-mariadb-server -p
-h learning-mariadb-server
GRANT ALL ON *.* TO 'username'@'%' IDENTIFIED BY 'your-password';
SELECT User, Host FROM mysql.user
docker volume create `your-volume-name`
docker run --name=learning-mariadb-server\
--detach \
--env="MYSQL_ROOT_PASSWORD=your-password" \
-v learning-mariadb-dbdata:/var/lib/mysql \
--network learning-mariadb-network \
mariadb

One more thing. Another caveat

docker run --detach \
--name=your-container-name \
-v learning-mariadb-dbdata:/var/lib/mysql \
--network learning-mariadb-network \
mariadb

Summary and tools you need

  1. create a network (use this directly in command line)
docker network create learning-mariadb-network
docker volume create learning-mariadb-dbdata
docker run --name=learning-mariadb-server\\
--detach \\
--env="MYSQL_ROOT_PASSWORD=your-password" \\
--network learning-mariadb-network \\
mariadb
docker run -it --rm \\
--name=learning-mariadb-client \\
--network learning-mariadb-network \\
mariadb \\
mysql -u root -h learning-mariadb-server -p
docker run --detach \\
--name=your-container-name \\
-v learning-mariadb-dbdata:/var/lib/mysql \\
--network learning-mariadb-network \\
mariadb

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Snowflake Python Series 1: Basics

Bisection Method

Fixing MacBook Pro Thermal Performance Issues

DataOps applied for Data Management

Installing Third-party JARs to a Maven Project — 1

Lexical and Dynamic Scope Usage

Code snippets that make you sus

Why Writing about Programming is Difficult

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chun Ming Wang

Chun Ming Wang

More from Medium

How to Analysis or Audit your Elasticsearch Requests #

Install Cassandra on Mac OS

AWS DMS Heartbeat — Avoid Critical Production DB Issues

Index Alias — ElasticSearch