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

Docker MySQL Multiple Database

How To Scrape Amazon Product Data and Pricing using Python

Learning Python: Week 1 — From Operators to Generators

Synchronize all your files, folders and cloud drives across multiple Google / Microsoft / Amazon…

Data access strategy for Blazor Application

Agile35 cards which will improve your backlog refinement process and engage every team member

Detailing the Evolution of the Workday Grid through Wardley Mapping

What happens when you type a URL into your browser?

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

Vagrant setup with Big Data Stack in Windows Subsystem for Linux

Install Cassandra on Mac OS

Using a docker container for postgis enabled database

Overcome the 10K query limit of AWS Open-search index in Python