# MariaDB + Adminer

> MariaDB database with Adminer, a lightweight database management tool.

- Category: Database Stacks
- Difficulty: beginner
- Components: mariadb, adminer
- Tags: mariadb, mysql, sql, admin-ui
- Source: https://docker.recipes/databases/mariadb-adminer

## Overview

MariaDB is a community-developed fork of MySQL created by the original MySQL developers after Oracle's acquisition of MySQL AB. Born from concerns about MySQL's future under Oracle, MariaDB has evolved into a robust database server that maintains MySQL compatibility while introducing advanced features like the Aria storage engine, Galera clustering, and enhanced JSON support. This makes it an ideal drop-in replacement for MySQL with superior performance and additional capabilities.

This stack combines MariaDB with Adminer, a lightweight database management tool that provides a clean web interface for database administration. Unlike heavyweight alternatives like phpMyAdmin, Adminer is distributed as a single PHP file and supports multiple database systems beyond just MySQL/MariaDB. The combination creates a complete database solution where MariaDB handles data storage and processing while Adminer provides intuitive database management through a web browser.

Developers working on PHP applications, WordPress sites, or any MySQL-compatible projects will find this stack invaluable for both development and production environments. The pairing is particularly useful for teams that need quick database access without installing desktop database tools, or for scenarios where you need to manage multiple database types through a single interface. MariaDB's enhanced features combined with Adminer's simplicity make this an excellent choice for startups, development teams, and anyone migrating away from Oracle's MySQL ecosystem.

## Features

- Aria storage engine with crash-safe MyISAM replacement and better caching
- Galera Cluster support for synchronous multi-master replication built into MariaDB
- Thread pool connection handling for improved performance under high concurrency
- Single-file Adminer deployment supporting MySQL, PostgreSQL, SQLite, and Oracle databases
- MariaDB's Oracle compatibility mode for easier enterprise application migration
- System-versioned tables enabling temporal queries and data history tracking
- Adminer's plugin system for extending functionality with custom themes and features
- ColumnStore storage engine for analytical workloads and data warehousing

## Use cases

- WordPress and PHP application hosting with enhanced MySQL compatibility
- Development environments requiring quick database setup and web-based management
- Small to medium business applications migrating away from Oracle MySQL
- Multi-database environments where developers work with MariaDB, PostgreSQL, and SQLite
- High-availability web applications utilizing MariaDB's Galera clustering capabilities
- Data analytics projects leveraging MariaDB's ColumnStore engine for warehousing
- Remote database administration where desktop tools aren't available or practical

## Prerequisites

- Minimum 1GB RAM for MariaDB with 128MB additional for Adminer web interface
- Port 3306 available for MariaDB database connections from external clients
- Port 8080 available for Adminer web interface access
- Basic understanding of SQL and relational database concepts
- Familiarity with web-based database administration tools
- Knowledge of environment variable configuration for database credentials

## docker-compose.yml

```yaml
services:
  mariadb:
    image: mariadb:11
    container_name: mariadb
    restart: unless-stopped
    environment:
      MARIADB_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD}
      MARIADB_DATABASE: ${MARIADB_DATABASE}
      MARIADB_USER: ${MARIADB_USER}
      MARIADB_PASSWORD: ${MARIADB_PASSWORD}
    volumes:
      - mariadb_data:/var/lib/mysql
    ports:
      - "3306:3306"
    networks:
      - mariadb-network

  adminer:
    image: adminer:latest
    container_name: adminer
    restart: unless-stopped
    ports:
      - "8080:8080"
    depends_on:
      - mariadb
    networks:
      - mariadb-network

volumes:
  mariadb_data:

networks:
  mariadb-network:
    driver: bridge
```

## .env

```bash
MARIADB_ROOT_PASSWORD=rootpassword
MARIADB_DATABASE=myapp
MARIADB_USER=appuser
MARIADB_PASSWORD=changeme
```

## Usage notes

- Docs: https://mariadb.com/kb/en/documentation/ | Adminer: https://www.adminer.org/
- Access Adminer at http://localhost:8080, select 'MySQL', server: mariadb
- Login with root/MARIADB_ROOT_PASSWORD or MARIADB_USER/MARIADB_PASSWORD
- Backup: docker exec mariadb mariadb-dump -u root -p --all-databases > backup.sql
- MySQL-compatible, most MySQL tools and drivers work
- Data persisted in mariadb_data volume

## Troubleshooting

- Connection refused to MariaDB: Ensure container is fully started by checking logs with docker logs mariadb
- Adminer shows 'MySQL server has gone away': Increase MariaDB's max_allowed_packet setting or wait_timeout values
- Access denied for user error: Verify MARIADB_USER and MARIADB_PASSWORD environment variables match login credentials
- Adminer interface not loading: Check that port 8080 isn't blocked by firewall and container started successfully
- Character encoding issues: Set MariaDB charset to utf8mb4 in my.cnf for full Unicode support
- Slow query performance: Enable MariaDB's thread pool with thread_handling=pool-of-threads configuration

