Skip to main content
MariaDB is a community-developed, commercially supported fork of MySQL. It’s designed to be highly compatible with MySQL while offering additional features and performance improvements.

Creating a MariaDB Database

To create a MariaDB database in Dokploy:
  1. Navigate to your project
  2. Select the environment
  3. Click “Add Service” and select “MariaDB”
  4. Configure the database settings

Basic Configuration

  • Name - A friendly name for your database
  • App Name - The Docker service name (used for internal DNS)
  • Description - Optional description
  • Docker Image - Default: mariadb:latest (recommended: mariadb:11 or mariadb:10.11)

Database Credentials

  • Database Name - Name of the database to create
  • Database User - Username for database access
  • Database Password - Password for the user
  • Root Password - Password for the root user
These credentials are automatically configured via environment variables:
  • MARIADB_DATABASE
  • MARIADB_USER
  • MARIADB_PASSWORD
  • MARIADB_ROOT_PASSWORD

Advanced Settings

  • External Port - Optional port to expose MariaDB externally (default internal port: 3306)
  • Command - Override the default container command
  • Args - Additional arguments to pass to MariaDB
  • Environment Variables - Additional custom environment variables

Connection Strings

Internal Connection (from other services)

When connecting from applications within the same Docker network:
Example:
MariaDB uses the same protocol and port as MySQL, making it a drop-in replacement in most cases.

External Connection

If you’ve configured an external port (e.g., 3307):

Connection String Formats

Environment Variables

MariaDB containers support these environment variables: Dokploy automatically sets the required variables based on your configuration.

Data Persistence

MariaDB data is stored in a Docker volume mounted at:
  • Mount Path: /var/lib/mysql
  • Volume Name: {appName}-data
The volume persists even when the container is stopped or removed.

Resource Configuration

Configure resource limits for your MariaDB instance:
MariaDB is generally more memory-efficient than MySQL. For production workloads, start with 1-2GB of memory and adjust based on usage.

Operations

Starting the Database

Click the “Start” button in the Dokploy UI or use the API:

Stopping the Database

Click the “Stop” button or use the API:

Reloading the Database

Reload applies configuration changes by stopping and starting the service:

Rebuilding the Database

Rebuilding will delete all data. Make sure to backup first!

Accessing MariaDB CLI

To access the MariaDB CLI in the running container:
Or use the legacy MySQL command:

Common MariaDB Commands

MariaDB is MySQL-compatible, so most MySQL commands work:

MariaDB-Specific Features

MariaDB offers several improvements over MySQL:

1. Better Performance

  • Improved query optimizer
  • Faster replication
  • Better thread pool implementation

2. Additional Storage Engines

  • Aria - Crash-safe MyISAM replacement
  • ColumnStore - Columnar storage for analytics
  • Spider - Sharding and partitioning

3. Enhanced JSON Support

MariaDB 10.2+ includes JSON functions:

4. Temporal Tables

System-versioned tables for historical data:

Backups

Dokploy provides automated backup functionality for MariaDB. Backups are performed using mariadb-dump (or mysqldump):
See the Backups page for detailed backup configuration.

Troubleshooting

Connection Refused

  • Verify the service is running in Dokploy UI
  • Check the service name matches your appName
  • Ensure your application is in the same Docker network

Authentication Failed

  • Verify credentials in the database settings
  • Check user has proper host permissions (% or specific IP)
  • Verify MARIADB_ environment variables are set correctly

Migration from MySQL

MariaDB is generally compatible with MySQL, but:
  1. Test thoroughly before production migration
  2. Check for MySQL-specific features not in MariaDB
  3. Review version compatibility (e.g., MariaDB 10.6 ≈ MySQL 8.0)
  4. Use mariadb-upgrade after migration

Best Practices

  1. Use Specific Versions - Pin to specific MariaDB versions (e.g., mariadb:10.11.6) instead of latest
  2. Strong Passwords - Use strong, randomly generated passwords for production
  3. Regular Backups - Configure automated backups and test restoration
  4. Monitor Resources - Watch memory and CPU usage, adjust limits as needed
  5. Security - Don’t expose MariaDB externally unless necessary
  6. Upgrade Path - Plan upgrades carefully; test in staging first
  7. Connection Pooling - Use connection pooling in your applications

Performance Tuning

Add these configuration options via environment variables or custom config:
MariaDB’s thread pool can significantly improve performance under high concurrency. Enable it with thread_handling=pool-of-threads.

MariaDB vs MySQL

Next Steps

Backups

Configure automated MariaDB backups

MySQL

Compare with MySQL documentation