Quick guide to run MariaDB with Docker on Ubuntu — SS

Study Section
2 min readDec 23, 2021

--

Quick guide to run MariaDB with Docker on Ubuntu — SS
Quick guide to run MariaDB with Docker on Ubuntu — SS

I already have MySQL running on my machine but I need MariaDB as well.
Login with the root user and run the following command

Step1:

# docker pull MariaDB
root@webnerhost:# docker pull mariadb
Using default tag: latest
latest: Pulling from library/mariadb
7b1a6ab2e44d: Already exists
034655750c88: Already exists
f0b757a2a0f0: Already exists
4bbcce26bc5e: Pull complete
04f220ee9266: Pull complete
89c8a77f7842: Pull complete
d1de5652303b: Pull complete
ef669123e59e: Pull complete
e5cec468d3a6: Pull complete
b14b1ba1d651: Pull complete
Digest: sha256:0f04ae6f30c5a3295fb7cc9be5780c15ff21d6028f999b19f5803114c1e8559e
Status: Downloaded newer image for mariadb:latest
docker.io/library/mariadb:latest

Step2:

#docker run -name MariadbContainer -p 3311:3306 -e MYSQL_ROOT_PASSWORD=yourpasssword -d mariadb
root@webnerhost:~# docker run --name MariadbContainer -p 3311:3306 -e MYSQL_ROOT_PASSWORD=yourpasssword -d mariadb
15586a3c9dc2d51fb0495166e0d715408ff3f7e5b9d767b242edb0338f7084e5

You can run the above command without using the -name flag, docker engine will create a container name with the default container value.

RUN: for creating and start
-name: give the name to the container
-p: to expose the port globally
exec: to go inside to running container or connect to a running container
-it: for interactive terminal

Step 3:

#docker exec -it mariadbContainer mysql -u root -p

root@webnerhost:~# docker exec -it MariadbContainer mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.6.5-MariaDB-1:10.6.5+maria~focal mariadb.org binary distribution

Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]>

Now you can work with MariaDB.

The English language is the most widely used language as a medium of communication around the world. Having a certification for the English language can be an advantage. StudySection provides an English certification exam that tests English language proficiency in English grammar, reading, and writing.

Originally published at https://studysection.com on December 23, 2021.

--

--

Study Section
Study Section

Written by Study Section

The most loved online platform for eCertification in several subjects including but not limited to Software Development, Aptitude and more.

No responses yet