{"id":36718,"date":"2026-06-08T08:38:55","date_gmt":"2026-06-08T07:38:55","guid":{"rendered":"https:\/\/www.milesweb.co.uk\/blog\/?p=36718"},"modified":"2026-06-08T08:38:57","modified_gmt":"2026-06-08T07:38:57","slug":"installing-and-using-mariadb-via-docker","status":"publish","type":"post","link":"https:\/\/www.milesweb.co.uk\/blog\/hosting\/installing-and-using-mariadb-via-docker\/","title":{"rendered":"Installing and Using MariaDB via Docker: Complete Beginner&#8217;s Guide"},"content":{"rendered":"\n<p>All modern applications use a database as the foundation; whether you are building a <a href=\"https:\/\/www.milesweb.co.uk\/hosting\/wordpress-hosting\/\">WordPress hosting<\/a> site, a SaaS application, an e-commerce shop, or a custom-built site, you need an effective database to store and manage your data.<\/p>\n\n\n\n<p>MariaDB is the first choice for developers, companies, and web hosts because it is a reliable, high-performance, fully featured open-source relational database engine. It powers all types of projects, from small personal sites to large-scale production environments.<\/p>\n\n\n\n<p>Traditionally, installing and <a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/view-mariadb-databases-in-ssh\/\">managing MariaDB databases<\/a> has been time-consuming. Many factors can complicate database deployment, such as differences in operating systems, dependency conflicts, version mismatches, and upgrade challenges.<\/p>\n\n\n\n<p>As a result, developers have adopted Docker to run MariaDB.<\/p>\n\n\n\n<style>\n.mdb-overview *{box-sizing:border-box;}\n.mdb-overview{\n  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;\n  max-width:1000px;\n  margin:25px auto;\n}\n.mdb-card{\n  background:#fff;\n  border:1px solid #e5e7eb;\n  border-radius:16px;\n  overflow:hidden;\n  box-shadow:0 2px 12px rgba(0,0,0,.05);\n}\n.mdb-header{\n  background:linear-gradient(135deg,#f8fafc,#eef4ff);\n  padding:18px 22px;\n  display:flex;\n  align-items:center;\n  gap:12px;\n  border-bottom:1px solid #e5e7eb;\n}\n.mdb-icon{\n  width:42px;\n  height:42px;\n  border-radius:10px;\n  background:#1d6fd8;\n  color:#fff;\n  display:flex;\n  align-items:center;\n  justify-content:center;\n  font-size:20px;\n  flex-shrink:0;\n}\n.mdb-header h3{\n  margin:0 !important;\n  padding:0 !important;\n  font-size:18px !important;\n  font-weight:700 !important;\n  border:none !important;\n}\n.mdb-content{\n  padding:22px;\n}\n.mdb-content p{\n  margin:0 0 18px 0 !important;\n  line-height:1.8;\n  color:#374151;\n  font-size:15px;\n}\n.mdb-content p:last-child{\n  margin-bottom:0 !important;\n}\n.mdb-note{\n  margin-top:18px;\n  padding:14px 16px;\n  background:#f8fafc;\n  border-left:4px solid #1d6fd8;\n  border-radius:8px;\n  font-size:14px;\n  line-height:1.7;\n}\n<\/style>\n\n<div class=\"mdb-overview\">\n  <div class=\"mdb-card\">\n\n    <div class=\"mdb-header\">\n      <div class=\"mdb-icon\">\ud83d\udc33<\/div>\n      <h3>MariaDB Docker Container \u2014 Quick Overview<\/h3>\n    <\/div>\n\n    <div class=\"mdb-content\">\n\n      <p>\n        With Docker, you can &#8220;containerize&#8221; MariaDB into a small package that can be deployed instantly. Rather than installing and configuring the database server yourself, you can create a fully functional MariaDB Docker container simply by typing one command. Docker removes the hassle of deploying a new database and enables faster deployment, less complicated maintenance, better portability, and a more organized development workflow for developers.\n      <\/p>\n\n      <p>\n        If you&#8217;re developing locally, testing application updates, or doing database deployments onto a VPS using Docker, MariaDB offers a simple yet consistent way to work with your databases.\n      <\/p>\n\n      <div class=\"mdb-note\">\n        \ud83d\udca1 This guide will show you how to install a MariaDB Docker container and then use it to connect to your database, create users and databases, manage persistence, and deploy the same. In the end, you will have a full set of working MariaDB Docker containers set up for developing, testing, or production.\n      <\/div>\n\n    <\/div>\n  <\/div>\n<\/div>\n\n\n\n<div class=\"skrlto-container\" style= \"border-radius: 13px;\npadding: 25px;\nbackground: #EEF6FF;\">\n<h2 class=\"skrlto-header-title\">Table Of Content<\/h2>\n<div class=\"skrlto-links-wrapper\">\n<ul>\n<li class=\"skroll-button\" data-skrolllto=\"WPT1WPTheme\">What is MariaDB?<\/li> \n<li class=\"skroll-button\" data-skrolllto=\"WPT2WPTheme\">What&#8217;s The Difference Between MariaDB vs. MySQL?<\/li>  \n<li class=\"skroll-button\" data-skrolllto=\"WPT3WPTheme\">What Are The Uses of MariaDB?<\/li> \n<li class=\"skroll-button\" data-skrolllto=\"WPT4WPTheme\">What is Docker?<\/li> \n<li class=\"skroll-button\" data-skrolllto=\"WPT5WPTheme\">Why Use Docker for Databases?<\/li>\n<li class=\"skroll-button\" data-skrolllto=\"WPT6WPTheme\">How to Install and Use MariaDB via Docker?<\/li> \n<li class=\"skroll-button\" data-skrolllto=\"WPT7WPTheme\">What Are The Key Docker Parameters?<\/li> \n<li class=\"skroll-button\" data-skrolllto=\"WPT8WPTheme\">How To Connect MariaDB in Docker?<\/li> \n<li class=\"skroll-button\" data-skrolllto=\"WPT9WPTheme\">How To Create Databases and Users?<\/li>\n<li class=\"skroll-button\" data-skrolllto=\"WPT10WPTheme\">How To Use Docker Compose for MariaDB?<\/li>\n<li class=\"skroll-button\" data-skrolllto=\"WPT11WPTheme\">What Are The Common Use Cases for MariaDB in Docker?<\/li>\n<li class=\"skroll-button\" data-skrolllto=\"WPT12WPTheme\">MariaDB Docker Commands Cheat Sheet<\/li>\n<li class=\"skroll-button\" data-skrolllto=\"WPT13WPTheme\">FAQs<\/li>\n<\/ul>\n<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"WPT1WPTheme\">What is MariaDB?<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"445\" src=\"https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/mariadb-explained.png\" alt=\"mariadb-explained\" class=\"wp-image-36723\" srcset=\"https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/mariadb-explained.png 800w, https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/mariadb-explained-300x167.png 300w, https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/mariadb-explained-768x427.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p><a href=\"https:\/\/www.milesweb.co.uk\/blog\/hosting\/what-is-mariadb\/\">MariaDB<\/a> is an open-source relational database management system (RDBMS). It is compatible with MySQL and built as MySQL&#8217;s community-driven fork. Thus, it is one of the most widely used database solutions for developing modern applications.<\/p>\n\n\n\n<p>MariaDB has a data structure based on relational tables and uses SQL for managing, retrieving, and manipulating that data. It provides exceptional reliability, performance, scalability, and strong community support.<\/p>\n\n\n\n<p><strong>MariaDB has many key features, including:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>High-performance query processing<\/li>\n\n\n\n<li>MySQL compatible<\/li>\n\n\n\n<li>Multiple storage engines<\/li>\n\n\n\n<li>Advanced security features<\/li>\n\n\n\n<li>Replication &amp; clustering support<\/li>\n\n\n\n<li>Scalable to support growing applications<\/li>\n\n\n\n<li>Active open-source development<\/li>\n<\/ul>\n\n\n\n<p>With its capabilities, MariaDB is often utilized in <a href=\"https:\/\/www.milesweb.co.uk\/\">web hosting<\/a> environments, cloud environments, enterprise applications, and modern containerized infrastructures.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"WPT2WPTheme\">What&#8217;s The Difference Between MariaDB vs. MySQL?<\/h2>\n\n\n\n<p>It&#8217;s true that MariaDB evolved from MySQL and thus shares multiple similarities with cloud MySQL. Both use SQL, support similar types of databases, and often allow for applications to run unmodified between them.<\/p>\n\n\n\n<p>However, while both databases have a strong emphasis on open-source development, MariaDB is more focused on developing new features, improving performance, adding new storage engines, and providing additional community-developed features as compared to MySQL. Therefore, developers use MariaDB for greater flexibility and maintain strong compatibility with their MySQL applications.<\/p>\n\n\n\n<p>When switching between MariaDB and MySQL, there is often no change in code for most websites and applications. This further adds to the simplicity of MariaDB.<\/p>\n\n\n\n<p><strong>Similar Read: <\/strong><a href=\"https:\/\/www.milesweb.co.uk\/blog\/hosting\/postgresql-vs-mariadb\/\"><strong>PostgreSQL vs MariaDB<\/strong><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"WPT3WPTheme\">What Are The Uses of MariaDB?<\/h2>\n\n\n\n<p>MariaDB&#8217;s flexibility allows for its use in a variety of applications, including the following examples:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"445\" src=\"https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/mariadb-use-cases.png\" alt=\"mariadb-use-cases\" class=\"wp-image-36724\" srcset=\"https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/mariadb-use-cases.png 800w, https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/mariadb-use-cases-300x167.png 300w, https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/mariadb-use-cases-768x427.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">&#8211; Web Applications<\/h3>\n\n\n\n<p>Many web application developers choose to use MariaDB as their back-end database to store user accounts, product catalogs, transactions, and other application-related data. The speed and stability of MariaDB have made it a database choice for many developers backing their applications with a relational database.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">&#8211; Content Management Systems (CMS)<\/h3>\n\n\n\n<p>Numerous content management systems, such as WordPress, Joomla, and Drupal, work seamlessly when used with MariaDB as their data store. In fact, many <a href=\"https:\/\/www.milesweb.co.uk\/blog\/hosting\/best-web-hosting-providers\/\">hosting providers<\/a> also provide MariaDB as their default database engine when hosting platforms such as a CMS.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">&#8211; SaaS Applications<\/h3>\n\n\n\n<p>MariaDB has become a go-to choice for companies that use Software-as-a-Service (SaaS) solutions to store customer data, track subscriptions, perform analytics, and operate their businesses. When coupled with Docker containers, deploying, scaling, and managing MariaDB across multiple environments is made simple.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"WPT4WPTheme\">What is Docker?<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"445\" src=\"https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/docker-explained.png\" alt=\"docker-explained\" class=\"wp-image-36721\" srcset=\"https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/docker-explained.png 800w, https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/docker-explained-300x167.png 300w, https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/docker-explained-768x427.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>Whether you need a database for a small personal website or to power a large-scale application developed for commercial use, MariaDB provides a reliable database engine that works best when deployed in a Docker environment.<\/p>\n\n\n\n<p>Docker allows applications to run in lightweight, isolated environments called containers. A container serves as the complete application package containing all the necessary files to execute the application. These include the application code, any dependent files, necessary libraries, and other configuration files.<\/p>\n\n\n\n<p>You can visualize containers as portable, complete applications. Whether you deploy a container on your desktop, a <a href=\"https:\/\/www.milesweb.co.uk\/hosting\/vps-hosting\/\">virtual private server (VPS)<\/a>, or a <a href=\"https:\/\/www.milesweb.co.uk\/hosting\/cloud-hosting\/\">cloud server<\/a>, the functionality remains unchanged.<\/p>\n\n\n\n<p>This is one of the main reasons developers choose to deploy MariaDB with Docker rather than manually.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"WPT5WPTheme\">Why Use Docker for Databases?<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"445\" src=\"https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/docker-benefits-in-databases.png\" alt=\"docker-benefits-in-databases\" class=\"wp-image-36720\" srcset=\"https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/docker-benefits-in-databases.png 800w, https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/docker-benefits-in-databases-300x167.png 300w, https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/docker-benefits-in-databases-768x427.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">&#8211; Quick Setup<\/h3>\n\n\n\n<p>Traditionally, setting up a database manually was a tedious task. Downloading the software packages, configuring the required services, managing all of the dependencies, and potentially troubleshooting compatibility problems were just the first few steps. With MariaDB and Docker, the entire database now can be deployed with a single command, reducing setup time from hours to minutes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">&#8211; Improved Isolation<\/h3>\n\n\n\n<p>MariaDB containers operate independently from both the host system and any applications running on the same host. Thus, each container has its own environment, which reduces possible software conflicts and aids in troubleshooting.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">&#8211; Portability Between Environments<\/h3>\n\n\n\n<p>Docker&#8217;s main benefit is that it is a consistent solution. If a MariaDB container operates properly in the local development environment. It also functions properly in the testing, VPS, or production environments. This prevents the &#8220;it works on my machine&#8221; scenario.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">&#8211; Version Management Made Easier<\/h3>\n\n\n\n<p>Projects require different versions of the database at times. Docker allows you to run specific versions of MariaDB quickly and easily without affecting the other apps on your server. You can upgrade\/downgrade and test\/modify a specific database version without having to change the entire environment.<\/p>\n\n\n\n<p>MariaDB is faster to develop, cleaner to manage, and provides greater flexibility when running on Docker for developers, system administrators, and businesses than using standard MariaDB principles and methods. The MariaDB reliability combined with the flexibility of using containers for deployment is perfect for the latest enterprise development and hosting processes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"WPT6WPTheme\">How to Install and Use MariaDB via Docker?<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Prerequisites<\/h3>\n\n\n\n<p>To ensure that your environment is prepared before, you need the following configurations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Docker Installed<\/strong><\/li>\n<\/ul>\n\n\n\n<p>First and foremost, you need Docker. This could either be Docker Desktop for use on Windows and Mac computers or Docker Engine when using a Linux server. After installing Docker on your machine, open a command prompt (CMD) and type the following command to check that Docker is installed correctly and working:<\/p>\n\n\n\n<p><strong><em>docker &#8211;version<\/em><\/strong><\/p>\n\n\n\n<p>If Docker is installed and running properly, the terminal will show the currently installed version of Docker.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Basic Linux\/Terminal Skills<\/strong><\/li>\n<\/ul>\n\n\n\n<p>You don\u2019t have to be a Linux wizard or a database administrator. However, some familiarity with the command line interface (CLI) is beneficial. Most commands associated with the MariaDB Docker image are run from a command line, including pulling images, starting containers, looking at logs, and connecting to your database.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>System Requirements<\/strong><\/li>\n<\/ul>\n\n\n\n<p>MariaDB containers are small in size (lightweight) and can run on less powerful hardware. For development and testing purposes, the following specifications for your machine should generally work:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>1-2 CPU cores.<\/li>\n\n\n\n<li>Minimum of 2GB of RAM.<\/li>\n\n\n\n<li>Minimum of 10GB of free storage.<\/li>\n\n\n\n<li>Docker engine installed or Docker desktop installed on your machine.<\/li>\n\n\n\n<li>A stable internet connection to download container images.<\/li>\n<\/ol>\n\n\n\n<p>For production workloads, the resource requirements depend on the database size, the amount of traffic, and the application demands.<\/p>\n\n\n\n<p>Once you have all of the above resources, you can install MariaDB Docker containers and create your first database instance.<\/p>\n\n\n\n<p>With Docker installed, MariaDB can be up and running within minutes. In Docker, we use images as templates to create containers. So, first download an officially owned MariaDB image from Docker Hub to use it as our template.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"445\" src=\"https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/steps-to-install-mariadb.png\" alt=\"steps-to-install-mariadb\" class=\"wp-image-36725\" srcset=\"https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/steps-to-install-mariadb.png 800w, https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/steps-to-install-mariadb-300x167.png 300w, https:\/\/www.milesweb.co.uk\/blog\/wp-content\/uploads\/2026\/06\/steps-to-install-mariadb-768x427.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Get the MariaDB image<\/h3>\n\n\n\n<p>To do this, run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>docker pull mariadb<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>After running the above command, Docker downloads the most recent stable version of the MariaDB image and stores it in your machine&#8217;s local repository.<\/p>\n\n\n\n<p><br>If you want to download a specific version of the MariaDB image instead of downloading the most recent version, you can specify the version tag to include.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>docker pull mariadb:11.8<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>For production environments, it is often recommended to use tags that specify the version you want to use. This avoids potential differences in functionality from recent upgrades and changes made in future releases.<\/p>\n\n\n\n<p>Next, verify that the image has been downloaded to your local repository:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker images<\/code><\/pre>\n\n\n\n<p>You should see the following (MariaDB) among the list of images you&#8217;ve downloaded to your local repository.<\/p>\n\n\n\n<p>Here\u2019s an example of the output you will see:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>REPOSITORY&nbsp;    TAG&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IMAGE ID&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CREATED\nmariadb&nbsp; &nbsp; &nbsp; &nbsp; latest &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;xxxxxxxxxxxx&nbsp; &nbsp; &nbsp;     2 days ago<\/code><\/pre>\n\n\n\n<p>At this point, we have everything we need from Docker to create a MariaDB container. Now let&#8217;s proceed with creating a MariaDB container, setting up a root password, mapping ports, and creating persistent storage so that our databases can survive if we restart the containers of MariaDB.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Create and Run a MariaDB Container<\/h3>\n\n\n\n<p>In the second step, we create and run a MariaDB container, including setting a password for the root user and mapping the appropriate port(s) to allow connections.<\/p>\n\n\n\n<p>The following command will create a MariaDB container and expose it on TCP port 3306.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -d \\\n&nbsp;&nbsp;--name mariadb-container \\\n&nbsp;&nbsp;-e MARIADB_ROOT_PASSWORD=StrongPassword \\\n&nbsp;&nbsp;-p 3306:3306 \\\n&nbsp;&nbsp;mariadb<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Add Persistent Storage<\/h3>\n\n\n\n<p>Next is to add a persistent volume for storing the database files. This ensures that any data in the database remains available after either recreating or restarting your container instance. The data is located in a volume created by Docker outside of the currently running instance.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -d \\\n&nbsp;&nbsp;--name mariadb-container \\\n&nbsp;&nbsp;-e MARIADB_ROOT_PASSWORD=StrongPassword \\\n&nbsp;&nbsp;-p 3306:3306 \\\n&nbsp;&nbsp;-v mariadb_data:\/var\/lib\/mysql \\\n&nbsp;&nbsp;mariadb<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"WPT7WPTheme\">What Are The Key Docker Parameters?<\/h2>\n\n\n\n<p>When you use Docker to run MariaDB, you will see all sorts of commands with many parameters and options set to customize how your container operates, how it stores its data, and how your application connects to the database.<\/p>\n\n\n\n<p>Let\u2019s take a look at an example for a command to run MariaDB on Docker:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -d \\\n--name mariadb-container \\\n-e MARIADB_ROOT_PASSWORD= StrongPassword \\\n-p 3306:3306 \\\n-v mariadb_data:\/var\/lib\/mysql \\\nmariadb<\/code><\/pre>\n\n\n\n<p>We\u2019ll break down some of the most critical parameters.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">&#8211;name<\/h3>\n\n\n\n<p>Assign a custom name (like \u2018mariadb-container\u2019) to your Docker container.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">&#8211;name mariadb-container<\/h3>\n\n\n\n<p>Using a custom name helps make managing the container easier and easier to identify instead of having to remember a randomly generated container ID.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">-e (Environment Variables)<\/h3>\n\n\n\n<p>When you start up MariaDB, you have to configure the environment for starting it. This allows you to specify the root database password and other environment variables when deploying to create databases and users automatically.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>-e MARIADB_ROOT_PASSWORD=StrongPassword<\/em><\/strong><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">-p (Port Mapping)<\/h3>\n\n\n\n<p>Port mapping connects your host machine to the MariaDB port on the Docker image running in your container. In the example above, the first number represents your host port, and the second number represents the port in your container. Since the default port for MariaDB is 3306, this mapping allows applications running outside of your container to connect to your MariaDB database.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>-p 3306:3306<\/em><\/strong><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">-v (Volumes)<\/h3>\n\n\n\n<p>Volumes are used to persist the data for your databases. Without using a volume, you will lose all of your database data if you remove the container. When you use Docker volumes, you will ensure that your MariaDB data is retained across restarts, upgrades, or recreations of the container.<\/p>\n\n\n\n-v mariadb_data:\/var\/lib\/mysql\n\n\n\n<h3 class=\"wp-block-heading\">-d (Detached Mode)<\/h3>\n\n\n\n<p>This parameter indicates to Docker that the container should run &#8220;in the background&#8221; (detached) so you can keep using the terminal while the MariaDB server is running.<br><strong><em>-d<\/em><\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why Do These Parameters Matter?<\/h3>\n\n\n\n<p>Understanding these options is key to understanding the majority of MariaDB Docker deployments. Regardless of whether you&#8217;re using MariaDB for local development, testing, or for production, parameters such as: port-mapping, volumes, and environment variables, allow you to set up your database to be available and protected, and also to keep it around after shutdown.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"WPT8WPTheme\">How To Connect MariaDB in Docker?<\/h2>\n\n\n\n<p>The next step after starting your MariaDB container is connecting to your MariaDB database. This connection can be made either directly from your Host OS or from inside the container.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Option 1: Connect using your Host OS<\/h3>\n\n\n\n<p>You can use a MariaDB compatible client to connect to the running MariaDB database on the mapped host port (port 3306).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>mariadb -h 127.0.0.1 -P 3306 -u root -p<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>Or using the MySQL client:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>mysql -h 127.0.0.1 -P 3306 -u root -p<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>If you&#8217;re using the MariaDB client, simply enter your MariaDB password. You&#8217;ll be connected to the MariaDB command-line interface. This allows you to create, edit, delete, and manage your databases, as well as create, edit, delete, and manage users and tables.<\/p>\n\n\n\n<p>This method of connecting to MariaDB is used by developers to connect their local applications, CMS, and database management tools (phpMyAdmin, DBeaver, MySQL Workbench, &#8230;) to MariaDB running in Docker.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Option 2: Connect from Inside the Container<\/h3>\n\n\n\n<p>The MariaDB Server can be accessed directly through the container if needed. This is helpful for troubleshooting issues, managing the database, or testing configurations that were made to the database in the container.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>First, enter a shell into the mariadb-container, using the `docker exec -it mariadb-container bash` command.<\/li>\n\n\n\n<li>To connect to MariaDB Server from the bash command line, use the `mysql` command.<\/li>\n\n\n\n<li>Enter the root user&#8217;s password that was provided during the installation of MariaDB.<\/li>\n\n\n\n<li>You will then see the MariaDB prompt: `MariaDB [(none)]&gt;`.<\/li>\n<\/ol>\n\n\n\n<p>At this point, you can run SQL commands against the database, view the databases that are on the server, create new user accounts, and complete administrative tasks directly from inside the container.<\/p>\n\n\n\n<p>Accessing MariaDB from your host machine or from inside the container both allow you to do everything with your MariaDB Docker database service. They are interchangeable and can be used based on what fits better in your workflow.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"WPT9WPTheme\">How To Create Databases and Users?<\/h2>\n\n\n\n<p>After completing the installation of the MariaDB server, creating a database and a dedicated user account for that database benefits your development efforts. By using a dedicated user instead of the root user for everything, you can improve your database security and make permission management easier.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Creating a New Database<\/h3>\n\n\n\n<p>Next, you can create a dedicated user account:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>CREATE USER 'appuser'@'%' IDENTIFIED BY 'StrongPassword';<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>This command creates the user account &#8220;appuser&#8221; that can connect from any location.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Creating a New User<\/h3>\n\n\n\n<p>Now you will need to grant the new user access to your new database:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>GRANT ALL PRIVILEGES ON myapp_db.* TO 'appuser'@'%';<\/em><\/strong><\/code><\/pre>\n\n\n\n<p><strong>Flush the changes:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>FLUSH PRIVILEGES;<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>MariaDB will instantly update its permission tables.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Testing the Connection<\/h3>\n\n\n\n<p>Exit from the current session:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>EXIT;<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>Now you can test the new account:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>mariadb -h 127.0.0.1 -u appuser -p;<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>If successful, change to your new database:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>USE myapp_db;<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>If you received no errors, you have successfully created a new database and configured it for use with a new user account.<\/p>\n\n\n\n<p>When using MariaDB Docker containers to run applications like WordPress, Laravel, SaaS platforms, and other production loads, establishing dedicated databases and users is critical. This keeps your setup organized and follows basic database security best practices.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"WPT10WPTheme\">How To Use Docker Compose for MariaDB?<\/h2>\n\n\n\n<p>Using a single Docker run command will work for deploying quickly, but managing your databases is easier when using Docker Compose. You will no longer have to remember long commands since you can define all of your MariaDB configuration in one single file. Therefore, you can consistently deploy all of the MariaDB configuration every time it is needed.<\/p>\n\n\n\n<p>This method is ideal for developing environments, multi-container applications, and production deployments. This configuration will automatically do the following:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Create a Docker Compose File<\/h3>\n\n\n\n<p>Create a new file called:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>docker-compose.yml<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>Add the following configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n mariadb:\n   image: mariadb:latest\n   container_name: mariadb-container\n   restart: unless-stopped\n   environment:\n     MARIADB_ROOT_PASSWORD: StrongPassword\n     MARIADB_DATABASE: myapp_db\n     MARIADB_USER: appuser\n     MARIADB_PASSWORD: AppPassword\n   ports:\n     - \"3306:3306\"\n   volumes:\n     - mariadb_data:\/var\/lib\/mysql\nvolumes:\n mariadb_data:<\/code><\/pre>\n\n\n\n<p>This configuration automatically<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a MariaDB container<\/li>\n\n\n\n<li>Set the root password<\/li>\n\n\n\n<li>Create a database at startup<\/li>\n\n\n\n<li>Create an application user<\/li>\n\n\n\n<li>Map port 3306<\/li>\n\n\n\n<li>Set up persistent storage<\/li>\n\n\n\n<li>Restart the container if needed<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. Launching the MariaDB Stack<\/h3>\n\n\n\n<p>Start your container with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>docker compose up -d<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>If you do not already have a MariaDB image downloaded, it will download the image and start the database in detached mode.<\/p>\n\n\n\n<p>You can check that your container is running by typing in:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>docker compose ps<\/em><\/strong><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Viewing the Logs of your Container<\/h3>\n\n\n\n<p>If you would like to view the log output from the MariaDB container, use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>docker compose logs -f<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>When you run this command, it will give you a continuous stream of output from the MariaDB container.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Stopping your Container<\/h3>\n\n\n\n<p>To stop the database without removing the data, type the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>docker compose stop<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>You can start the container up again at any time by typing the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker compose start<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Removing your Stack<\/h3>\n\n\n\n<p>To stop and remove all of the containers created by using Docker Compose, run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>docker compose down<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>The data for the database is stored in a Docker volume. Therefore, if you want to remove your data, you will have to explicitly delete the volume that the database is using.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"WPT11WPTheme\">What Are The Common Use Cases for MariaDB in Docker<\/h2>\n\n\n\n<p>One of the biggest advantages of running MariaDB on Docker is flexibility. The same containerized database can be used for development, testing, and production environments without major configuration changes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. WordPress + MariaDB Deployment<\/h3>\n\n\n\n<p>Many WordPress users choose MariaDB as their database solution. Deploying MariaDB Docker containers in conjunction with your WordPress application greatly enhances the speed and ease (deployment process), particularly when utilizing Docker Compose. Both MariaDB and WordPress operate in their respective isolated containers but still communicate over the same Docker-based network, thereby creating clean and portable hosting environments.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Local Development Environments<\/h3>\n\n\n\n<p>Many developers create local application development environments using MariaDB Docker containers. This way, they don\u2019t need to install a database directly onto their operating systems. Instead, they can spin up a temporary instance of MariaDB any time they need to test code or perform action within an application. By keeping application development environments clean without the software installed directly onto hard drives, developers minimize the application compatibility issues. This is simpler to switch between different versions of MariaDB as they test the software.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Testing a Database Migration<\/h3>\n\n\n\n<p>Database schema changes and migrations result in unforeseen challenges. Developers leverage MariaDB Docker to build temporary test environments with databases (these are just a copy of the production database). This allows developers to validate their proposed migrations, upgrades, and changes to the application before deploying them into production, thereby mitigating the risk of downtime or data loss.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"WPT12WPTheme\">MariaDB Docker Commands Cheat Sheet<\/h2>\n\n\n\n<p>After you have a working MariaDB Docker container, you&#8217;ll find yourself using a few basic Docker commands repeatedly for managing, troubleshooting, and maintaining your container. Having these basic commands available makes your everyday database administration jobs much easier.<\/p>\n\n\n\n<style>\n.docker-cmds{\n  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;\n  max-width:1000px;\n  margin:25px auto;\n}\n.dc-card{\n  background:#fff;\n  border:1px solid #e5e7eb;\n  border-radius:16px;\n  overflow:hidden;\n  box-shadow:0 2px 12px rgba(0,0,0,.05);\n}\n.dc-header{\n  padding:18px 22px;\n  background:#f8fafc;\n  border-bottom:1px solid #e5e7eb;\n}\n.dc-header h3{\n  margin:0 !important;\n  font-size:18px !important;\n  font-weight:700 !important;\n}\n.dc-table-header{\n  display:grid;\n  grid-template-columns: 2fr 1fr;\n  gap:20px;\n  padding:14px 22px;\n  background:#f3f4f6;\n  font-weight:700;\n  font-size:13px;\n  text-transform:uppercase;\n  letter-spacing:.05em;\n  color:#374151;\n}\n.dc-row{\n  display:grid;\n  grid-template-columns:2fr 1fr;\n  gap:20px;\n  align-items:center;\n  padding:14px 22px;\n  border-top:1px solid #eef2f7;\n}\n.command-wrap{\n  display:flex;\n  gap:10px;\n  align-items:center;\n}\n.command{\n  flex:1;\n  background:#111827;\n  color:#fff;\n  padding:10px 12px;\n  border-radius:8px;\n  font-family:Consolas,Monaco,monospace;\n  font-size:13px;\n  overflow-x:auto;\n}\n.copy-btn{\n  border:none;\n  background:#1d6fd8;\n  color:#fff;\n  border-radius:8px;\n  padding:10px 12px;\n  cursor:pointer;\n  font-size:13px;\n  font-weight:600;\n}\n.copy-btn:hover{\n  opacity:.9;\n}\n.purpose{\n  font-size:14px;\n  line-height:1.5;\n  color:#374151;\n}\n@media(max-width:768px){\n  .dc-table-header{\n    display:none;\n  }\n  .dc-row{\n    grid-template-columns:1fr;\n  }\n}\n<\/style>\n\n<div class=\"docker-cmds\">\n  <div class=\"dc-card\">\n\n    <div class=\"dc-header\">\n      <h3>\ud83d\udccc MariaDB Docker Command Cheat Sheet<\/h3>\n    <\/div>\n\n    <div class=\"dc-table-header\">\n      <div>Command<\/div>\n      <div>Purpose<\/div>\n    <\/div>\n\n    <div class=\"dc-row\">\n      <div class=\"command-wrap\">\n        <div class=\"command\" id=\"cmd1\">docker start mariadb-container<\/div>\n        <button class=\"copy-btn\" onclick=\"copyCommand('cmd1',this)\">Copy<\/button>\n      <\/div>\n      <div class=\"purpose\">Start a stopped MariaDB container<\/div>\n    <\/div>\n\n    <div class=\"dc-row\">\n      <div class=\"command-wrap\">\n        <div class=\"command\" id=\"cmd2\">docker stop mariadb-container<\/div>\n        <button class=\"copy-btn\" onclick=\"copyCommand('cmd2',this)\">Copy<\/button>\n      <\/div>\n      <div class=\"purpose\">Stop the running MariaDB container<\/div>\n    <\/div>\n\n    <div class=\"dc-row\">\n      <div class=\"command-wrap\">\n        <div class=\"command\" id=\"cmd3\">docker restart mariadb-container<\/div>\n        <button class=\"copy-btn\" onclick=\"copyCommand('cmd3',this)\">Copy<\/button>\n      <\/div>\n      <div class=\"purpose\">Restart the container<\/div>\n    <\/div>\n\n    <div class=\"dc-row\">\n      <div class=\"command-wrap\">\n        <div class=\"command\" id=\"cmd4\">docker logs mariadb-container<\/div>\n        <button class=\"copy-btn\" onclick=\"copyCommand('cmd4',this)\">Copy<\/button>\n      <\/div>\n      <div class=\"purpose\">View container logs and error messages<\/div>\n    <\/div>\n\n    <div class=\"dc-row\">\n      <div class=\"command-wrap\">\n        <div class=\"command\" id=\"cmd5\">docker logs -f mariadb-container<\/div>\n        <button class=\"copy-btn\" onclick=\"copyCommand('cmd5',this)\">Copy<\/button>\n      <\/div>\n      <div class=\"purpose\">Monitor logs in real time<\/div>\n    <\/div>\n\n    <div class=\"dc-row\">\n      <div class=\"command-wrap\">\n        <div class=\"command\" id=\"cmd6\">docker exec -it mariadb-container bash<\/div>\n        <button class=\"copy-btn\" onclick=\"copyCommand('cmd6',this)\">Copy<\/button>\n      <\/div>\n      <div class=\"purpose\">Open a shell session inside the container<\/div>\n    <\/div>\n\n    <div class=\"dc-row\">\n      <div class=\"command-wrap\">\n        <div class=\"command\" id=\"cmd7\">docker inspect mariadb-container<\/div>\n        <button class=\"copy-btn\" onclick=\"copyCommand('cmd7',this)\">Copy<\/button>\n      <\/div>\n      <div class=\"purpose\">View detailed container configuration and networking information<\/div>\n    <\/div>\n\n    <div class=\"dc-row\">\n      <div class=\"command-wrap\">\n        <div class=\"command\" id=\"cmd8\">docker ps<\/div>\n        <button class=\"copy-btn\" onclick=\"copyCommand('cmd8',this)\">Copy<\/button>\n      <\/div>\n      <div class=\"purpose\">List all running containers<\/div>\n    <\/div>\n\n    <div class=\"dc-row\">\n      <div class=\"command-wrap\">\n        <div class=\"command\" id=\"cmd9\">docker ps -a<\/div>\n        <button class=\"copy-btn\" onclick=\"copyCommand('cmd9',this)\">Copy<\/button>\n      <\/div>\n      <div class=\"purpose\">List all containers, including stopped ones<\/div>\n    <\/div>\n\n    <div class=\"dc-row\">\n      <div class=\"command-wrap\">\n        <div class=\"command\" id=\"cmd10\">docker images<\/div>\n        <button class=\"copy-btn\" onclick=\"copyCommand('cmd10',this)\">Copy<\/button>\n      <\/div>\n      <div class=\"purpose\">View downloaded Docker images<\/div>\n    <\/div>\n\n    <div class=\"dc-row\">\n      <div class=\"command-wrap\">\n        <div class=\"command\" id=\"cmd11\">docker compose up -d<\/div>\n        <button class=\"copy-btn\" onclick=\"copyCommand('cmd11',this)\">Copy<\/button>\n      <\/div>\n      <div class=\"purpose\">Start MariaDB using Docker Compose<\/div>\n    <\/div>\n\n    <div class=\"dc-row\">\n      <div class=\"command-wrap\">\n        <div class=\"command\" id=\"cmd12\">docker compose down<\/div>\n        <button class=\"copy-btn\" onclick=\"copyCommand('cmd12',this)\">Copy<\/button>\n      <\/div>\n      <div class=\"purpose\">Stop and remove Docker Compose containers<\/div>\n    <\/div>\n\n    <div class=\"dc-row\">\n      <div class=\"command-wrap\">\n        <div class=\"command\" id=\"cmd13\">docker compose logs -f<\/div>\n        <button class=\"copy-btn\" onclick=\"copyCommand('cmd13',this)\">Copy<\/button>\n      <\/div>\n      <div class=\"purpose\">View Docker Compose logs in real time<\/div>\n    <\/div>\n\n  <\/div>\n<\/div>\n\n<script>\nfunction copyCommand(id, btn) {\n  const text = document.getElementById(id).innerText;\n  navigator.clipboard.writeText(text);\n\n  const original = btn.innerText;\n  btn.innerText = \"Copied \u2713\";\n\n  setTimeout(() => {\n    btn.innerText = original;\n  }, 1500);\n}\n<\/script>\n\n\n\n<div class=\"vlt-box\">\n    <div class=\"box-title\" style=\"background:#D5EAFF; color:#000\">\n        Closing Insights\n    <\/div>\n\n    <div class=\"box-content\">\n\n        <p>Using Docker containers to run MariaDB gives you the benefits of a free, open-source database with the ease of deploying and managing lightweight containers. Instead of installing and maintaining an application, you can quickly deploy, manage, and scale MariaDB within a containerised environment.<\/p>\n\n        <p>Our detailed guide shows how to connect to the database, create users and databases, set up persistent volume storage for your database, and manage your deployments using Docker Compose. These functions allow developers, systems administrators, and businesses the ability to use MariaDB on Docker for an effective, flexible, and simple database environment. As your projects get larger, Docker Compose becomes increasingly important. It allows multi-container deployment, increases consistency across various environments, and makes maintaining a database by using Docker Compose easier.<\/p>\n\n        <p>Whether you are <a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-build-a-wordpress-website-using-ai-website-builder\/\">creating a WordPress site<\/a>, developing a software as a service (SaaS) application, or creating a local testing environment for your application, depending on the projects you are developing, running MariaDB with Docker is a great way to have a portable, lightweight, and efficient database environment for your workloads.<\/p>\n    <\/div>\n<\/div>\n\n\n\n<div class=\"vlt-box \">\n<h2 class=\"box-title\" style=\"background:#D5EAFF; color:#000\" id=\"WPT13WPTheme\">FAQs<\/h2>\n<div class=\"box-content\" >\n<h3 class=\"box-title\" style=\"background:#D5EAFF; color:#000\">1. Is MariaDB Docker suitable for production?<\/h3>\n<p>If your MariaDB Docker instance is appropriately configured, you can safely use it in production. Deploy a MariaDB instance that ensures availability and reliability by following certain best practices, such as the use of persistent Docker volumes, strong passwords, regular backups, resource limits, and secure network settings. Numerous businesses make use of MariaDB with Docker in their web, SaaS applications, and containerized workloads.<\/p>\n\n<h3 class=\"box-title\" style=\"background:#D5EAFF; color:#000\">2. How do I persist data in MariaDB Docker?<\/h3>\n<p>Persistent data is achieved using Docker volumes. By mounting your volume to MariaDB&#8217;s data directory (\/var\/lib\/mysql), your databases remain intact after restarting, updating, or recreating the container. This is regarded as a best practice for deploying any MariaDB Docker instance.<\/p>\n\n<h3 class=\"box-title\" style=\"background:#D5EAFF; color:#000\">3. What port does MariaDB use in Docker?<\/h3>\n<p>Port 3306 is the default port for MariaDB. This port will typically be mapped to the host machine when executing MariaDB via Docker with the following syntax:<br>\n-p 3306:3306<br>\nYou can connect to the MariaDB instance through the mapped host port using client applications or through application database clients such as MySQL Workbench or phpMyAdmin, provided you&#8217;re able to access the host that is running the Docker instance.<\/p>\n\n<h3 class=\"box-title\" style=\"background:#D5EAFF; color:#000\">4. Can I run multiple MariaDB containers?<\/h3>\n<p>Yes, you can run multiple MariaDB Docker containers on one physical server as long as you assign separate host ports per MariaDB container. The internal port for MariaDB will always remain the same.<br>\nFor example:<br>\n-p 3306:3306<br>\n-p 3307:3306<br>\nBy mapping ports using a different host port for each container, you can run multiple instances of MariaDB independently without concern for port conflicts. This is especially useful for development, testing, and multi-application environments.<\/p>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>All modern applications use a database as the foundation; whether you are building a WordPress hosting site, a SaaS application, an e-commerce shop, or a custom-built site, you need an effective database to store and manage your data. MariaDB is the first choice for developers, companies, and web hosts because it is a reliable, high-performance,&#8230; <a class=\"read-more\" href=\"https:\/\/www.milesweb.co.uk\/blog\/hosting\/installing-and-using-mariadb-via-docker\/\">Read More<\/a><\/p>\n","protected":false},"author":1014,"featured_media":36722,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-36718","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hosting"],"_links":{"self":[{"href":"https:\/\/www.milesweb.co.uk\/blog\/wp-json\/wp\/v2\/posts\/36718","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/blog\/wp-json\/wp\/v2\/users\/1014"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=36718"}],"version-history":[{"count":5,"href":"https:\/\/www.milesweb.co.uk\/blog\/wp-json\/wp\/v2\/posts\/36718\/revisions"}],"predecessor-version":[{"id":36732,"href":"https:\/\/www.milesweb.co.uk\/blog\/wp-json\/wp\/v2\/posts\/36718\/revisions\/36732"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/blog\/wp-json\/wp\/v2\/media\/36722"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=36718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=36718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=36718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}