{"id":18099,"date":"2025-09-17T15:58:22","date_gmt":"2025-09-17T12:58:22","guid":{"rendered":"https:\/\/unihost.com\/help\/?p=18099"},"modified":"2026-11-06T16:49:52","modified_gmt":"2026-11-06T13:49:52","slug":"installing-mariadb-with-portainer","status":"publish","type":"post","link":"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/","title":{"rendered":"How to Install MariaDB with Portainer (Docker)"},"content":{"rendered":"<div class=\"unihost-mariadb-article\" style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;\">\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">Install MariaDB on your VPS using the Unihost MariaDB with phpMyAdmin template in Portainer. Select the application, set secure database credentials, and deploy the stack. Keep the database files in a persistent Docker volume, verify connectivity, and create backups with mariadb-dump. Expose port 3306 only when remote access is necessary and restricted.<\/p>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\"><strong>Compatibility:<\/strong> Linux with Docker Engine and Portainer, MariaDB official Docker image and phpMyAdmin. Available features depend on the template version.<\/p>\n<h2 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:18pt;line-height:1.3;margin:23px 0 12px;\">Requirements<\/h2>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">You need a VPS with Docker and Portainer, administrator access, and free disk space for your database and backups. The original Unihost workflow also uses Nginx Proxy Manager to publish phpMyAdmin.<\/p>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\"><a href=\"https:\/\/unihost.com\/help\/what-is-portainer\/\">What is Portainer<\/a> \u00b7 <a href=\"https:\/\/unihost.com\/vps\/\">VPS Unihost<\/a><\/p>\n<h2 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:18pt;line-height:1.3;margin:23px 0 12px;\">Steps<\/h2>\n<h3 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:14pt;line-height:1.35;margin:18px 0 9px;\">Step 1. Deploy the Unihost template<\/h3>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">In Portainer, open Templates \u2192 Application, choose MariaDB with phpMyAdmin, fill in the required fields and deploy. The new MariaDB stack appears under Stacks. Verify containers with:<\/p>\n<pre style=\"font-family:Ubuntu,monospace;font-size:12pt;background:#f4f4f4;padding:10px;white-space:pre-wrap;overflow-wrap:anywhere;overflow-x:auto;line-height:1.4;margin:10px 0 15px;\">docker ps<\/pre>\n<p style=\"margin:10px 0 16px;\"><img decoding=\"async\" alt=\"Selecting the MariaDB with phpMyAdmin application template in Portainer\" loading=\"lazy\" src=\"https:\/\/minio2.unihost.com\/wp-help2\/2025\/09\/Screenshot-from-2025-09-10-13-02-08.png\" style=\"max-width:100%;height:auto;display:block;\"\/ title=\"How to Install MariaDB with Portainer (Docker) - Image 1\"><\/p>\n<p style=\"margin:10px 0 16px;\"><img decoding=\"async\" alt=\"MariaDB stack visible in the Portainer Stacks list\" loading=\"lazy\" src=\"https:\/\/minio2.unihost.com\/wp-help2\/2025\/09\/Screenshot-from-2025-09-10-13-02-24.png\" style=\"max-width:100%;height:auto;display:block;\"\/ title=\"How to Install MariaDB with Portainer (Docker) - Image 2\"><\/p>\n<h3 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:14pt;line-height:1.35;margin:18px 0 9px;\">Step 2. Configure credentials and storage<\/h3>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">The official MariaDB image supports these initialization variables:<\/p>\n<table style=\"width:100%;border-collapse:collapse;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;margin:12px 0;\">\n<thead>\n<tr>\n<th style=\"border:1px solid #ddd;padding:8px;text-align:left;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;\">Variable<\/th>\n<th style=\"border:1px solid #ddd;padding:8px;text-align:left;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;\">Purpose<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border:1px solid #ddd;padding:8px;text-align:left;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;\">MARIADB_ROOT_PASSWORD<\/td>\n<td style=\"border:1px solid #ddd;padding:8px;text-align:left;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;\">MariaDB root password<\/td>\n<\/tr>\n<tr>\n<td style=\"border:1px solid #ddd;padding:8px;text-align:left;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;\">MARIADB_DATABASE<\/td>\n<td style=\"border:1px solid #ddd;padding:8px;text-align:left;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;\">Database created during initialization<\/td>\n<\/tr>\n<tr>\n<td style=\"border:1px solid #ddd;padding:8px;text-align:left;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;\">MARIADB_USER<\/td>\n<td style=\"border:1px solid #ddd;padding:8px;text-align:left;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;\">Application database user<\/td>\n<\/tr>\n<tr>\n<td style=\"border:1px solid #ddd;padding:8px;text-align:left;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;\">MARIADB_PASSWORD<\/td>\n<td style=\"border:1px solid #ddd;padding:8px;text-align:left;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;\">Password for the application user<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre style=\"font-family:Ubuntu,monospace;font-size:12pt;background:#f4f4f4;padding:10px;white-space:pre-wrap;overflow-wrap:anywhere;overflow-x:auto;line-height:1.4;margin:10px 0 15px;\">MARIADB_ROOT_PASSWORD=YOUR_STRONG_ROOT_PASSWORD\r\nMARIADB_DATABASE=appdb\r\nMARIADB_USER=appuser\r\nMARIADB_PASSWORD=YOUR_STRONG_USER_PASSWORD<\/pre>\n<p style=\"margin:10px 0 16px;\">\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">Use strong, unique passwords. Initialization variables do not change an existing database stored in a reused volume. In the stack, keep a persistent volume mounted at \/var\/lib\/mysql:<\/p>\n<pre style=\"font-family:Ubuntu,monospace;font-size:12pt;background:#f4f4f4;padding:10px;white-space:pre-wrap;overflow-wrap:anywhere;overflow-x:auto;line-height:1.4;margin:10px 0 15px;\">volumes:\r\n  - mariadb_data:\/var\/lib\/mysql<\/pre>\n<h3 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:14pt;line-height:1.35;margin:18px 0 9px;\">Step 3. Configure network access and phpMyAdmin<\/h3>\n<p><img decoding=\"async\" alt=\"Additional MariaDB and Portainer setup screenshot from the original Unihost guide\" loading=\"lazy\" src=\"https:\/\/minio2.unihost.com\/wp-help2\/2025\/09\/Screenshot-from-2025-09-12-15-30-59.png\" style=\"max-width:100%;height:auto;display:block;\"\/ title=\"How to Install MariaDB with Portainer (Docker) - Image 3\"><\/p>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">Containers on the same Docker network can connect to MariaDB on port 3306 without publishing it. Only enable external access when required, and restrict the port with the firewall or a VPN. The Unihost template lets you enable the port mapping in the stack editor:<\/p>\n<pre style=\"font-family:Ubuntu,monospace;font-size:12pt;background:#f4f4f4;padding:10px;white-space:pre-wrap;overflow-wrap:anywhere;overflow-x:auto;line-height:1.4;margin:10px 0 15px;\">ports:\r\n  - \"3306:3306\"<\/pre>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px\">To access phpMyAdmin securely, configure a domain with Nginx Proxy Manager (NPM):<\/p>\n<ol style=\"list-style:decimal outside;padding-left:27px;margin:8px 0 14px;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55\">\n<li style=\"display:list-item;margin:5px 0;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55\">Create a DNS A record for db.example.com pointing to the VPS public IP.<\/li>\n<li style=\"display:list-item;margin:5px 0;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55\">Open NPM \u2192 Hosts \u2192 Proxy Hosts \u2192 Add Proxy Host.<\/li>\n<li style=\"display:list-item;margin:5px 0;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55\">Set Domain Names to db.example.com and Scheme to http.<\/li>\n<li style=\"display:list-item;margin:5px 0;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55\">Set Forward Hostname \/ IP to the phpMyAdmin container hostname reachable from NPM, and Forward Port to 80.<\/li>\n<li style=\"display:list-item;margin:5px 0;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55\">Under SSL, request a Let\u2019s Encrypt certificate, enable Force SSL, save and visit https:\/\/db.example.com.<\/li>\n<\/ol>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px\">NPM must be able to reach phpMyAdmin through a Docker network. Restrict access to phpMyAdmin. NPM proxies the phpMyAdmin HTTP interface, not the MariaDB database protocol on TCP port 3306.<\/p>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px\"><a href=\"https:\/\/unihost.com\/help\/nginx-proxy-manager\/\">Nginx Proxy Manager installation and setup guide<\/a><\/p>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px\">Keep database port 3306 private unless remote access is explicitly required; restrict any published port using firewall rules.<\/p>\n<p style=\"margin:10px 0 16px;\"><img decoding=\"async\" alt=\"Proxy Host for phpMyAdmin in Nginx Proxy Manager\" loading=\"lazy\" src=\"https:\/\/minio2.unihost.com\/wp-help2\/2025\/09\/Screenshot-from-2025-09-10-13-02-31.png\" style=\"max-width:100%;height:auto;display:block;\"\/ title=\"How to Install MariaDB with Portainer (Docker) - Image 4\"><\/p>\n<p style=\"margin:10px 0 16px;\"><img decoding=\"async\" alt=\"Internal host phpmyadmin with port 80 in Nginx Proxy Manager\" loading=\"lazy\" src=\"https:\/\/minio2.unihost.com\/wp-help2\/2025\/09\/Screenshot-from-2025-09-10-13-02-44.png\" style=\"max-width:100%;height:auto;display:block;\"\/ title=\"How to Install MariaDB with Portainer (Docker) - Image 5\"><\/p>\n<h3 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:14pt;line-height:1.35;margin:18px 0 9px;\">Step 4. Verify the database connection<\/h3>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">Open the MariaDB terminal (replace CONTAINER with the name shown by docker ps):<\/p>\n<pre style=\"font-family:Ubuntu,monospace;font-size:12pt;background:#f4f4f4;padding:10px;white-space:pre-wrap;overflow-wrap:anywhere;overflow-x:auto;line-height:1.4;margin:10px 0 15px;\">docker exec -it CONTAINER mariadb -u root -p<\/pre>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">After entering the password, run the SQL query below. The list should contain your application database. You can also log in through phpMyAdmin over HTTPS.<\/p>\n<pre style=\"font-family:Ubuntu,monospace;font-size:12pt;background:#f4f4f4;padding:10px;white-space:pre-wrap;overflow-wrap:anywhere;overflow-x:auto;line-height:1.4;margin:10px 0 15px;\">SHOW DATABASES;<\/pre>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:10px 0 12px;\">The screenshots show the original phpMyAdmin interface. For production access, use HTTPS through Nginx Proxy Manager and restrict access to trusted users.<\/p>\n<p style=\"margin:10px 0 16px;\"><img decoding=\"async\" alt=\"phpMyAdmin login screen after deploying MariaDB\" loading=\"lazy\" src=\"https:\/\/minio2.unihost.com\/wp-help2\/2025\/09\/Screenshot-from-2025-09-10-13-02-55.png\" style=\"max-width:100%;height:auto;display:block;\"\/ title=\"How to Install MariaDB with Portainer (Docker) - Image 6\"><\/p>\n<p style=\"margin:10px 0 16px;\"><img decoding=\"async\" alt=\"phpMyAdmin dashboard connected to the MariaDB server\" loading=\"lazy\" src=\"https:\/\/minio2.unihost.com\/wp-help2\/2025\/09\/Screenshot-from-2025-09-10-13-03-07.png\" style=\"max-width:100%;height:auto;display:block;\"\/ title=\"How to Install MariaDB with Portainer (Docker) - Image 7\"><\/p>\n<h3 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:14pt;line-height:1.35;margin:18px 0 9px;\">Step 5. Back up MariaDB<\/h3>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">Create a logical SQL backup on the Docker host with mariadb-dump:<\/p>\n<pre style=\"font-family:Ubuntu,monospace;font-size:12pt;background:#f4f4f4;padding:10px;white-space:pre-wrap;overflow-wrap:anywhere;overflow-x:auto;line-height:1.4;margin:10px 0 15px;\">docker exec CONTAINER sh -c 'exec mariadb-dump -u root -p\"$MARIADB_ROOT_PASSWORD\" appdb' &gt; backup.sql<\/pre>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">This example uses the MARIADB_ROOT_PASSWORD environment variable inside the container. If the template uses Docker secrets, use the matching authentication method. Check the backup file and store a copy outside the VPS.<\/p>\n<h3 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:14pt;line-height:1.35;margin:18px 0 9px;\">Step 6. Update MariaDB<\/h3>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">Back up the data first. In Portainer, select a compatible MariaDB image version, redeploy the stack and retain the existing volume. For supported upgrades the official image provides:<\/p>\n<pre style=\"font-family:Ubuntu,monospace;font-size:12pt;background:#f4f4f4;padding:10px;white-space:pre-wrap;overflow-wrap:anywhere;overflow-x:auto;line-height:1.4;margin:10px 0 15px;\">MARIADB_AUTO_UPGRADE=1<\/pre>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">MARIADB_AUTO_UPGRADE runs the required system-table upgrade, but does not replace a full backup or guarantee a downgrade. Review the upgrade path before changing the major version.<\/p>\n<h2 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:18pt;line-height:1.3;margin:23px 0 12px;\">Verify<\/h2>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">Check that the MariaDB container is running, phpMyAdmin connects, the database is present, and the SQL backup is nonempty. Inspect the logs if needed:<\/p>\n<pre style=\"font-family:Ubuntu,monospace;font-size:12pt;background:#f4f4f4;padding:10px;white-space:pre-wrap;overflow-wrap:anywhere;overflow-x:auto;line-height:1.4;margin:10px 0 15px;\">docker ps\r\ndocker logs --tail 50 CONTAINER\r\nls -lh backup.sql<\/pre>\n<h2 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:18pt;line-height:1.3;margin:23px 0 12px;\">Troubleshooting<\/h2>\n<h3 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:14pt;line-height:1.35;margin:18px 0 9px;\">MariaDB does not start<\/h3>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">Check the container logs, configuration, disk space and volume permissions.<\/p>\n<h3 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:14pt;line-height:1.35;margin:18px 0 9px;\">Cannot connect remotely<\/h3>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">Verify the database account, container network, port mapping and firewall. Do not expose 3306 to all IP addresses.<\/p>\n<h3 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:14pt;line-height:1.35;margin:18px 0 9px;\">Password changes are ignored<\/h3>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">The initialization environment variables do not reset passwords in an existing data directory. Change passwords with MariaDB SQL commands.<\/p>\n<h2 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:18pt;line-height:1.3;margin:23px 0 12px;\">FAQ<\/h2>\n<h3 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:14pt;line-height:1.35;margin:18px 0 9px;\">How do I connect to MariaDB from another server?<\/h3>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">Publish port 3306 only if needed, restrict it to trusted IPs, and use an appropriate MariaDB user. A private network or VPN is preferable.<\/p>\n<h3 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:14pt;line-height:1.35;margin:18px 0 9px;\">Where is the data stored?<\/h3>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">MariaDB stores data in \/var\/lib\/mysql inside the container. A persistent Docker volume keeps it across container replacement.<\/p>\n<h3 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:14pt;line-height:1.35;margin:18px 0 9px;\">How do I back up the database?<\/h3>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">Use mariadb-dump to export an SQL backup and save a copy outside the server. Test restoration periodically.<\/p>\n<h3 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:14pt;line-height:1.35;margin:18px 0 9px;\">How do I upgrade MariaDB?<\/h3>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">Back up first, choose a compatible image tag, preserve the volume and redeploy. MARIADB_AUTO_UPGRADE can update system tables when necessary.<\/p>\n<h2 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:18pt;line-height:1.3;margin:23px 0 12px;\">Related Articles<\/h2>\n<ul style=\"list-style:disc outside;margin:8px 0 15px;padding-left:28px;\">\n<li style=\"display:list-item;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:5px 0;\"><a href=\"https:\/\/unihost.com\/help\/what-is-portainer\/\">What is Portainer<\/a><\/li>\n<li style=\"display:list-item;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:5px 0;\"><a href=\"https:\/\/unihost.com\/help\/installing-traefik-reverse-proxy-with-portainer\/\">Installing Traefik with Portainer<\/a><\/li>\n<li style=\"display:list-item;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:5px 0;\"><a href=\"https:\/\/unihost.com\/help\/installing-ghost-cms-with-portainer\/\">Installing Ghost CMS with Portainer<\/a><\/li>\n<li style=\"display:list-item;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:5px 0;\"><a href=\"https:\/\/unihost.com\/blog\/zero-downtime-migration\/\">Database migration planning<\/a><\/li>\n<li style=\"display:list-item;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:5px 0\"><a href=\"https:\/\/unihost.com\/help\/nginx-proxy-manager\/\">Nginx Proxy Manager setup<\/a><\/li>\n<\/ul>\n<h3 style=\"font-family:Ubuntu,Arial,sans-serif;font-size:14pt;line-height:1.35;margin:18px 0 9px;\">Run MariaDB with Unihost<\/h3>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\">Deploy MariaDB with prepared Portainer application templates or choose dedicated database hosting.<\/p>\n<ul style=\"list-style:disc outside;margin:8px 0 15px;padding-left:28px;\">\n<li style=\"display:list-item;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:5px 0;\"><a href=\"https:\/\/unihost.com\/solutions\/\">Ready-to-use solutions<\/a><\/li>\n<li style=\"display:list-item;font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:5px 0;\"><a href=\"https:\/\/unihost.com\/dedicated\/database-hosting\/\">Database dedicated servers<\/a><\/li>\n<\/ul>\n<p style=\"font-family:Ubuntu,Arial,sans-serif;font-size:12pt;line-height:1.55;margin:0 0 12px;\"><a href=\"https:\/\/mariadb.com\/docs\/server\/server-management\/automated-mariadb-deployment-and-administration\/docker-and-mariadb\/mariadb-server-docker-official-image-environment-variables\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">Official MariaDB Docker image documentation<\/a><\/p>\n<\/div>\n<p><script type=\"application\/ld+json\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"headline\":\"How to Install MariaDB with Portainer (Docker)\",\"inLanguage\":\"en\",\"author\":{\"@type\":\"Organization\",\"name\":\"Unihost\"},\"publisher\":{\"@type\":\"Organization\",\"name\":\"Unihost\",\"url\":\"https:\/\/unihost.com\"},\"dateModified\":\"2026-11-06\",\"mainEntityOfPage\":\"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/\"},{\"@type\":\"FAQPage\",\"mainEntity\":[{\"@type\":\"Question\",\"name\":\"How do I connect to MariaDB from another server?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Publish port 3306 only if needed, restrict it to trusted IPs, and use an appropriate MariaDB user. A private network or VPN is preferable.\"}},{\"@type\":\"Question\",\"name\":\"Where is the data stored?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"MariaDB stores data in \/var\/lib\/mysql inside the container. A persistent Docker volume keeps it across container replacement.\"}},{\"@type\":\"Question\",\"name\":\"How do I back up the database?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Use mariadb-dump to export an SQL backup and save a copy outside the server. Test restoration periodically.\"}},{\"@type\":\"Question\",\"name\":\"How do I upgrade MariaDB?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Back up first, choose a compatible image tag, preserve the volume and redeploy. MARIADB_AUTO_UPGRADE can update system tables when necessary.\"}}]}]}<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install MariaDB on your VPS using the Unihost MariaDB with phpMyAdmin template in Portainer. Select the application, set secure database credentials, and deploy the stack. Keep the database files in a persistent Docker volume, verify connectivity, and create backups with mariadb-dump. Expose port 3306 only when remote access is necessary and restricted. Compatibility: Linux with [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[158],"tags":[472,993],"class_list":["post-18099","post","type-post","status-publish","format-standard","hentry","category-dedicated-servers","tag-mariadb","tag-portainer"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Install MariaDB in Docker with Portainer: Volumes, Users, Backups | Unihost<\/title>\n<meta name=\"description\" content=\"Run MariaDB in Docker using the Unihost Portainer template: persistent volume, root password and users, remote access, backups with mariadb-dump and updates.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Install MariaDB in Docker with Portainer: Volumes, Users, Backups | Unihost\" \/>\n<meta property=\"og:description\" content=\"Run MariaDB in Docker using the Unihost Portainer template: persistent volume, root password and users, remote access, backups with mariadb-dump and updates.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/\" \/>\n<meta property=\"og:site_name\" content=\"Unihost.FAQ\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/unihost\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-09-17T12:58:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-06T13:49:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/minio2.unihost.com\/wp-help2\/2025\/09\/Screenshot-from-2025-09-10-13-02-08.png\" \/>\n<meta name=\"author\" content=\"Unihost Support\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@unihost\" \/>\n<meta name=\"twitter:site\" content=\"@unihost\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Unihost Support\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/installing-mariadb-with-portainer\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/installing-mariadb-with-portainer\\\/\"},\"author\":{\"name\":\"Unihost Support\",\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/#\\\/schema\\\/person\\\/bb5ae95f38577c920e6a7507888b715a\"},\"headline\":\"How to Install MariaDB with Portainer (Docker)\",\"datePublished\":\"2025-09-17T12:58:22+00:00\",\"dateModified\":\"2026-11-06T13:49:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/installing-mariadb-with-portainer\\\/\"},\"wordCount\":809,\"publisher\":{\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/installing-mariadb-with-portainer\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/minio2.unihost.com\\\/wp-help2\\\/2025\\\/09\\\/Screenshot-from-2025-09-10-13-02-08.png\",\"keywords\":[\"mariadb\",\"Portainer\"],\"articleSection\":[\"02. Dedicated servers\"],\"inLanguage\":\"en\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/installing-mariadb-with-portainer\\\/\",\"url\":\"https:\\\/\\\/unihost.com\\\/help\\\/installing-mariadb-with-portainer\\\/\",\"name\":\"Install MariaDB in Docker with Portainer: Volumes, Users, Backups | Unihost\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/installing-mariadb-with-portainer\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/installing-mariadb-with-portainer\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/minio2.unihost.com\\\/wp-help2\\\/2025\\\/09\\\/Screenshot-from-2025-09-10-13-02-08.png\",\"datePublished\":\"2025-09-17T12:58:22+00:00\",\"dateModified\":\"2026-11-06T13:49:52+00:00\",\"description\":\"Run MariaDB in Docker using the Unihost Portainer template: persistent volume, root password and users, remote access, backups with mariadb-dump and updates.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/installing-mariadb-with-portainer\\\/#breadcrumb\"},\"inLanguage\":\"en\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/unihost.com\\\/help\\\/installing-mariadb-with-portainer\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/installing-mariadb-with-portainer\\\/#primaryimage\",\"url\":\"https:\\\/\\\/minio2.unihost.com\\\/wp-help2\\\/2025\\\/09\\\/Screenshot-from-2025-09-10-13-02-08.png\",\"contentUrl\":\"https:\\\/\\\/minio2.unihost.com\\\/wp-help2\\\/2025\\\/09\\\/Screenshot-from-2025-09-10-13-02-08.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/installing-mariadb-with-portainer\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Unihost\",\"item\":\"https:\\\/\\\/unihost.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Help\",\"item\":\"https:\\\/\\\/unihost.com\\\/help\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Install MariaDB with Portainer (Docker)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/#website\",\"url\":\"https:\\\/\\\/unihost.com\\\/help\\\/\",\"name\":\"Unihost.FAQ\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/unihost.com\\\/help\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/#organization\",\"name\":\"Unihost\",\"alternateName\":\"Unihost\",\"url\":\"https:\\\/\\\/unihost.com\\\/help\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/unihost.com\\\/help\\\/minio.php?2026\\\/01\\\/minio.png\",\"contentUrl\":\"https:\\\/\\\/unihost.com\\\/help\\\/minio.php?2026\\\/01\\\/minio.png\",\"width\":300,\"height\":300,\"caption\":\"Unihost\"},\"image\":{\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/unihost\\\/\",\"https:\\\/\\\/x.com\\\/unihost\",\"https:\\\/\\\/www.instagram.com\\\/unihost\\\/?hl=en\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/unihost-com\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCITKsxMDnslQY8brN3advgw\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/unihost.com\\\/help\\\/#\\\/schema\\\/person\\\/bb5ae95f38577c920e6a7507888b715a\",\"name\":\"Unihost Support\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a0c9db17c2a0d93e8a0d5ac123f8c5db750ad4d3d5657369c0c4e480f5af77b8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a0c9db17c2a0d93e8a0d5ac123f8c5db750ad4d3d5657369c0c4e480f5af77b8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a0c9db17c2a0d93e8a0d5ac123f8c5db750ad4d3d5657369c0c4e480f5af77b8?s=96&d=mm&r=g\",\"caption\":\"Unihost Support\"},\"sameAs\":[\"https:\\\/\\\/unihost.com\\\/\"],\"url\":\"https:\\\/\\\/unihost.com\\\/help\\\/author\\\/support\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Install MariaDB in Docker with Portainer: Volumes, Users, Backups | Unihost","description":"Run MariaDB in Docker using the Unihost Portainer template: persistent volume, root password and users, remote access, backups with mariadb-dump and updates.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/","og_locale":"en_US","og_type":"article","og_title":"Install MariaDB in Docker with Portainer: Volumes, Users, Backups | Unihost","og_description":"Run MariaDB in Docker using the Unihost Portainer template: persistent volume, root password and users, remote access, backups with mariadb-dump and updates.","og_url":"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/","og_site_name":"Unihost.FAQ","article_publisher":"https:\/\/www.facebook.com\/unihost\/","article_published_time":"2025-09-17T12:58:22+00:00","article_modified_time":"2026-11-06T13:49:52+00:00","og_image":[{"url":"https:\/\/minio2.unihost.com\/wp-help2\/2025\/09\/Screenshot-from-2025-09-10-13-02-08.png","type":"","width":"","height":""}],"author":"Unihost Support","twitter_card":"summary_large_image","twitter_creator":"@unihost","twitter_site":"@unihost","twitter_misc":{"Written by":"Unihost Support","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/#article","isPartOf":{"@id":"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/"},"author":{"name":"Unihost Support","@id":"https:\/\/unihost.com\/help\/#\/schema\/person\/bb5ae95f38577c920e6a7507888b715a"},"headline":"How to Install MariaDB with Portainer (Docker)","datePublished":"2025-09-17T12:58:22+00:00","dateModified":"2026-11-06T13:49:52+00:00","mainEntityOfPage":{"@id":"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/"},"wordCount":809,"publisher":{"@id":"https:\/\/unihost.com\/help\/#organization"},"image":{"@id":"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/#primaryimage"},"thumbnailUrl":"https:\/\/minio2.unihost.com\/wp-help2\/2025\/09\/Screenshot-from-2025-09-10-13-02-08.png","keywords":["mariadb","Portainer"],"articleSection":["02. Dedicated servers"],"inLanguage":"en"},{"@type":"WebPage","@id":"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/","url":"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/","name":"Install MariaDB in Docker with Portainer: Volumes, Users, Backups | Unihost","isPartOf":{"@id":"https:\/\/unihost.com\/help\/#website"},"primaryImageOfPage":{"@id":"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/#primaryimage"},"image":{"@id":"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/#primaryimage"},"thumbnailUrl":"https:\/\/minio2.unihost.com\/wp-help2\/2025\/09\/Screenshot-from-2025-09-10-13-02-08.png","datePublished":"2025-09-17T12:58:22+00:00","dateModified":"2026-11-06T13:49:52+00:00","description":"Run MariaDB in Docker using the Unihost Portainer template: persistent volume, root password and users, remote access, backups with mariadb-dump and updates.","breadcrumb":{"@id":"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/#breadcrumb"},"inLanguage":"en","potentialAction":[{"@type":"ReadAction","target":["https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/"]}]},{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/#primaryimage","url":"https:\/\/minio2.unihost.com\/wp-help2\/2025\/09\/Screenshot-from-2025-09-10-13-02-08.png","contentUrl":"https:\/\/minio2.unihost.com\/wp-help2\/2025\/09\/Screenshot-from-2025-09-10-13-02-08.png"},{"@type":"BreadcrumbList","@id":"https:\/\/unihost.com\/help\/installing-mariadb-with-portainer\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Unihost","item":"https:\/\/unihost.com\/"},{"@type":"ListItem","position":2,"name":"Help","item":"https:\/\/unihost.com\/help\/"},{"@type":"ListItem","position":3,"name":"How to Install MariaDB with Portainer (Docker)"}]},{"@type":"WebSite","@id":"https:\/\/unihost.com\/help\/#website","url":"https:\/\/unihost.com\/help\/","name":"Unihost.FAQ","description":"","publisher":{"@id":"https:\/\/unihost.com\/help\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/unihost.com\/help\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en"},{"@type":"Organization","@id":"https:\/\/unihost.com\/help\/#organization","name":"Unihost","alternateName":"Unihost","url":"https:\/\/unihost.com\/help\/","logo":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/unihost.com\/help\/#\/schema\/logo\/image\/","url":"https:\/\/unihost.com\/help\/minio.php?2026\/01\/minio.png","contentUrl":"https:\/\/unihost.com\/help\/minio.php?2026\/01\/minio.png","width":300,"height":300,"caption":"Unihost"},"image":{"@id":"https:\/\/unihost.com\/help\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/unihost\/","https:\/\/x.com\/unihost","https:\/\/www.instagram.com\/unihost\/?hl=en","https:\/\/www.linkedin.com\/company\/unihost-com","https:\/\/www.youtube.com\/channel\/UCITKsxMDnslQY8brN3advgw"]},{"@type":"Person","@id":"https:\/\/unihost.com\/help\/#\/schema\/person\/bb5ae95f38577c920e6a7507888b715a","name":"Unihost Support","image":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/secure.gravatar.com\/avatar\/a0c9db17c2a0d93e8a0d5ac123f8c5db750ad4d3d5657369c0c4e480f5af77b8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a0c9db17c2a0d93e8a0d5ac123f8c5db750ad4d3d5657369c0c4e480f5af77b8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a0c9db17c2a0d93e8a0d5ac123f8c5db750ad4d3d5657369c0c4e480f5af77b8?s=96&d=mm&r=g","caption":"Unihost Support"},"sameAs":["https:\/\/unihost.com\/"],"url":"https:\/\/unihost.com\/help\/author\/support\/"}]}},"_links":{"self":[{"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/posts\/18099","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/comments?post=18099"}],"version-history":[{"count":29,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/posts\/18099\/revisions"}],"predecessor-version":[{"id":20550,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/posts\/18099\/revisions\/20550"}],"wp:attachment":[{"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/media?parent=18099"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/categories?post=18099"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/tags?post=18099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}