MySQL and MariaDB setup for Mautic

Preparing the Mautic database means choosing a supported MySQL or MariaDB version, using InnoDB, granting the application only the rights it needs and deciding whether the database runs on its own host.

On this page

Why the Mautic MySQL setup matters before installation

Mautic 7.0 needs MySQL 5.7 or higher with InnoDB, or MariaDB 10.2 or higher, according to the Mautic requirements page. Choose the engine and version before the installer runs, because changing the database platform after contacts, segments and campaign history exist means a migration project, not a configuration change. The database holds every contact record, consent state, segment membership, campaign step and tracking event, so the decision also shapes your backup, restore and recovery plan. Confirm the exact version your target Mautic release accepts against the requirements page, since the supported database versions are tied to each release line.

Teams face this work in three situations. The first is a new install, where the database can be created cleanly with the right engine, character set and a dedicated user. The second is a legacy installation being moved onto a supported release, where the existing database may use an older engine or an unsupported version and must be checked before any upgrade step. The third is separating database hosting from the web server, which many teams do once a single machine is no longer enough. In that case the database host needs network access restricted to the Mautic servers, its own backups, and a clear owner. Ask whether your current database version and storage engine appear on the requirements page for the Mautic release you plan to run.

The database check belongs in the same review as the PHP version check. Mautic's release lines have different PHP requirements, so a server that satisfies one release may not satisfy the next. Record the Mautic release, the PHP version, the database engine and version, and the connection method in one document before provisioning. If you are unsure whether a shared or managed database service meets the InnoDB and version requirements, confirm that with the provider in writing. Mautic's own requirements page is the authoritative reference for what the database must be, and it should be checked again at each planned upgrade.

Database options and when each fits

This table compares running the Mautic database on the same VPS as the application with a separate database host or managed service that your team or a provider operates. Read each row against your own staffing, backup obligations and access rules, since the right option depends on who will be on call for the database. The main takeaway is that co-location is simpler to start but shifts backup, patching and access control onto the same server that runs the application.

Decision areaCo-located on the Mautic VPSSeparate database host or managed service
Version fitInstall MySQL 5.7 or higher with InnoDB, or MariaDB 10.2 or higher, as required by the Mautic 7.0 requirements. Confirm the exact version against the release you plan to run.Same minimums apply. Ask the provider which MySQL or MariaDB versions it offers and whether it lets you pin a version and schedule upgrades.
BackupsBackups run on the same machine, so a disk or host failure can remove both application and data. Off-host copies must be added deliberately.Backups can run from a separate system. Ask whether point-in-time recovery is included, how long backups are kept and whether you can restore to a new instance.
LatencyApplication and database share local resources, which keeps query latency low but competes with PHP, cron and queue workers for memory and CPU.Queries cross a network link, so latency depends on placement in the same network or region. Measure this in your environment before committing to a design.
Maintenance windowsDatabase patching and restarts require the application to be stopped or updated in the same window, and kernel or OS work affects both.Database maintenance can be scheduled separately, but you still need to coordinate with Mautic cron and queue activity to avoid interrupted jobs.
Access controlDatabase credentials sit next to application files, so file permission mistakes can expose them. Restrict the database user to the Mautic schema.Network rules can limit which hosts reach the database port. Ask the provider how it handles user accounts, encryption in transit and audit logs.
Team responsibilityThe team that runs the Mautic server also runs the database, including patches, storage growth and recovery tests.Responsibilities split between your team and the provider. Confirm in writing who handles patching, failover, backup restore tests and incident response.
Growth and scalingScaling usually means a larger server, which moves the database and application together and may require a later split.Application and database can scale separately, but the split adds configuration work for database host settings and firewall rules.
What to ask a providerNot applicable. Plan the same checks you would ask a provider: backup location, restore test frequency and monitoring of disk and connections.Ask for the supported engine versions, InnoDB confirmation, backup and restore terms, maintenance notice, network access options and how fees are structured. Request a quote tied to a written scope.

How to set up the Mautic database step by step

This sequence takes an empty database server to a state where Mautic's installer can connect with a dedicated, least-privilege account, using a recorded table prefix and an InnoDB engine that matches the release you chose.

  1. Confirm the engine version against the release

    Before you create anything, check the database requirements on the Mautic requirements page for the exact release you plan to install. Mautic 7.0 requires MySQL 5.7 or higher with InnoDB, or MariaDB 10.2 or higher. Confirm the version your database server reports, then confirm the release line you will install is still in security support using the Mautic releases page. Record the engine name and version in your build notes. Done when the version string from your server meets the requirement for that release.

  2. Create an InnoDB database with the right character set

    On the database server, create a new database dedicated to Mautic and confirm its default storage engine is InnoDB. Mautic's requirements call for InnoDB, so do not rely on a server default that may differ from your build standard. Set the character set and collation your organization uses for contact data, and confirm them with your data owners because contact names and addresses often include non-ASCII characters. Done when a query against the server's engine settings shows InnoDB as the default and the new database shows the intended character set.

  3. Create a dedicated application user

    Create a database account used only by Mautic, with a strong password stored in your secrets manager rather than in a shared runbook. Do not reuse the administrative root account or a DBA account for the application. Name the account so that its purpose is obvious in audit logs. Done when the account exists and can be listed by the database administrator, and you have recorded where its password is stored.

  4. Grant privileges limited to the Mautic database

    Grant the application user privileges on the Mautic database only, not on all databases and not with global administrative rights. Confirm the exact privilege set with the Mautic installation documentation for your release, since the installer and upgrade tasks may need more rights than day-to-day operation. Plan to reduce privileges after installation if your release allows it, and confirm that with the vendor docs. Done when a login as the application user can read and write inside the Mautic database and is refused when it attempts to access another database.

  5. Decide and record the table prefix

    Choose a table prefix now, before the installer creates tables, because changing it later means reworking the database. A prefix is useful when several applications share one database, but a dedicated database may not need one. Record the decision, the reasoning and the value in the build record so that backups, restores and future upgrade work use the same prefix. Done when the prefix is written in your configuration record and the database contains no tables that conflict with it.

  6. Restrict network access to the Mautic host

    Configure the database server so it accepts connections only from the web host and any worker or cron hosts that run Mautic, and from your backup agent if it connects directly. Apply the rule at the host firewall and in the account's host restriction, so that the user is bound to specific source addresses. If you use containers or a load balancer, confirm which addresses the database will see. Done when a connection from an approved Mautic host succeeds and a connection attempt from any other host, including your workstation, is refused.

  7. Run the installer connection test

    From the Mautic host, enter the database host, database name, user, password and prefix into the web or command-line installer, then run the connection test before completing the install. Record the result. If the test fails, check the host restriction, the port, the account host pattern and the password in that order. After a successful install, confirm that the tables were created with the expected prefix and that the engine reported for them is InnoDB. Done when the installer reports a successful connection and a table inspection shows InnoDB tables with the recorded prefix.

Table prefixes and database user permissions

A table prefix is a short string placed in front of every Mautic table name, such as mautic_contacts or mkt_contacts. It matters when more than one application shares a database schema, or when a team wants to tell Mautic tables apart at a glance during audits and restores. If the database is dedicated to Mautic, the prefix adds little, and a default prefix is usually fine. The prefix is written into the configuration during installation and is used by every query Mautic runs afterward. Changing it later means renaming every table and updating the configuration in lockstep, which is error-prone on a live instance. Decide the prefix before the first install, record it in the build runbook, and confirm with the install documentation for your release how the prefix is set and whether the installer or a later step handles it.

Give the Mautic application its own database user with the narrowest rights that let the web and worker processes run. Day-to-day operation needs to read and write data in the Mautic schema, and that is all the running application should hold. The installer and some upgrade or migration steps typically need broader rights, such as creating and altering tables, so keep those rights out of the everyday account. Create a separate, short-lived administrative account for installs, major upgrades and schema changes, grant it only for the window it is needed, and remove it afterward. Treat each elevated change as a documented, approved event with a backup taken first. Because exact privilege lists change between releases, confirm the grants required for your target version against the installation documentation before you write the GRANT statements, and test them on a staging copy of the database.

Security and operational considerations for the Mautic database

The database holds every contact, consent record and campaign history Mautic relies on, so its network exposure, credentials, backups and patching deserve the same care as the application. The cards below cover the controls to decide on before the first install and the routine checks that keep them working.

Restrict network access to the port

Mautic only needs the database port open to the web and worker hosts that run it, so allow inbound connections on the MySQL or MariaDB port from those addresses and nothing else. Keep the database off any public interface and confirm with a port scan from outside the private network. Review the rule whenever you add a cron or worker host, because a forgotten host is the most common reason a database is reachable more widely than intended.

Encrypt connections to a separate host

When the database runs on its own host, traffic between the web server and the database crosses your network and should be protected with TLS. Ask your DBA to enable TLS on the server and confirm the Mautic connection uses it, which you can check with a status query on an active session. Decide early whether the server certificate is verified against an internal CA, since a connection that accepts any certificate protects against casual sniffing only.

Store credentials in the configuration file carefully

Mautic writes database settings, including the password, into its local configuration file during installation. Restrict that file so only the web server user can read it, keep it out of version control and backups that leave your control, and use a password generated for this database only. Rotate the password through the database and the configuration together, and record who holds the credential so a departing administrator does not keep access.

Test backups and encrypt them

Schedule logical or physical database backups and encrypt them before they leave the host, because the database contains personal data for every contact. A backup only counts once a restore has been tested on a separate machine, so schedule a restore test and time it against your recovery goals. Keep at least one copy outside the database host so a host failure does not remove both the data and its backups.

Enable access logging for the database

Turn on the database audit or general query logging that your edition supports, or the connection and login logging available in MariaDB, so you can see which accounts connect and from where. Logs grow quickly on a busy marketing database, so set retention and rotation before enabling them. Review failed logins and unexpected accounts on a fixed schedule rather than only after an incident.

Patch the engine on a fixed schedule

Plan database engine patching around the Mautic release cadence, which publishes monthly patch releases, minor releases every three months and major releases every two years. Check the supported PHP and database versions for your Mautic release line before each upgrade, because a database upgrade can require a matching Mautic release. Confirm the vendor support window for your MySQL or MariaDB version with the vendor before choosing it.

Patch release cadence
Monthly
Mautic releases

Questions teams ask about Mautic database setup

Is MySQL or MariaDB better for Mautic?

Neither is better in general, and the choice usually comes down to what your team already operates and what your Mautic release requires. Mautic 7.0 accepts MySQL 5.7 or higher with InnoDB, or MariaDB 10.2 or higher, so either engine can work if it meets that floor. Decide on the version your platform team can patch, back up and restore on a schedule, and check the Mautic requirements page for the exact list before you commit. If your organization already runs a supported MySQL or MariaDB fleet with tested backups, reuse that standard rather than adding a second engine. Confirm the chosen version against the release you plan to install, because support windows differ by Mautic line.

Does Mautic need its own database host?

No, Mautic does not require a dedicated database server, but a separate host is a common choice for production. Running the database apart from the web and cron workload lets you size memory and disk for the database, restrict network access to it, and patch or restore it without taking the application down. The trade-off is one more system to monitor, back up and secure, plus latency between the application and the database that you should measure in your own network. Mautic's requirements also rule out shared hosting, so whatever host you choose should be a VPS, dedicated server or equivalent that you control. Confirm the network path and firewall rules with your Mautic installation documentation before cutover.

What does the database work cost, and what drives it up?

The cost splits into the engineering time to provision the database, create users and permissions, configure InnoDB and connect Mautic, plus the recurring cost of running it. The one-time work is usually the smaller part. Costs rise with the number of environments you need (production, staging, disaster recovery), how many contacts and events you expect to store, the backup and restore testing you require, and whether the database must sit in a restricted network zone that needs approvals. Costs fall when your team already runs MySQL or MariaDB and has a backup standard. Ask any provider for a fixed-scope quote that lists each environment, the backup and restore test, and who owns ongoing patching. DeployOpen does not publish prices, and a quote follows from the written scope.

How long does Mautic database setup take, and what does it need from us?

Duration depends on how many environments you build, how much access review your security team requires, and whether the database host already exists. Your side needs to provide a target host that meets the requirements page, network rules between the web tier and the database, a named owner for database accounts and backups, and a decision on the MySQL or MariaDB version. Plan time for a restore test, not only the install, because an untested backup is not a recovery plan. Ask the provider to confirm the calendar and dependencies in the written scope, and confirm the version floors and support dates on the Mautic releases page before any build starts.

Which database user permissions does Mautic need?

Mautic needs a dedicated database user with rights limited to its own schema, which keeps other applications and administrators off its data. The installer and upgrades can require broader privileges than daily operation, so separate the account used to install or migrate from the account the running application uses. Set a clear rule for who holds the privileged credentials and where they are stored, and review them after each upgrade. Table prefixes help when several applications share one server, because they make ownership of tables visible during audits and restores. Confirm the exact privilege list in the Mautic installation documentation for your release.

Can an internal team set up the Mautic database without outside help?

Yes, an experienced MySQL or MariaDB administrator can set up the database for Mautic with the official documentation, and many teams do it in-house. The work is familiar: create the schema, a restricted user, InnoDB tables, network rules and backups. External help adds value when the team lacks time, when the database must meet audit evidence requirements, or when the build has to be documented for assessors. DeployOpen plans, implements, hardens, backs up and documents self-hosted platforms in your own infrastructure, and it prepares evidence for compliance assessments, but it does not issue audit reports or certifications. Whichever route you take, assign a named owner for backups and patching from day one.

Does the database choice affect Mautic upgrades?

It can, because each Mautic release line sets its own minimum database version, and a database that falls below that floor blocks an upgrade. Mautic publishes a monthly patch cadence, quarterly minor releases and a two-yearly major release, so the database has to keep pace with that rhythm. Check the requirements for the target release before you upgrade the application, and plan database upgrades as a separate change with a tested backup. Ask whether the chosen MySQL or MariaDB line is still receiving vendor security fixes during the window you plan to run Mautic. Confirm the current support dates on the Mautic releases page.

What goes wrong when the Mautic database is set up poorly?

The most common failures are an installer that cannot create tables because privileges are too narrow, a storage engine that is not InnoDB, and a database that shares resources with the web tier and starves under load. Backups that were never restored also surface late, usually during an incident. Another frequent problem is an unclear owner, so nobody patches the database or rotates its credentials. Prevent these by checking the engine and version before install, separating privileges, placing the database on controlled capacity and running a documented restore test. Confirm each setting against the Mautic requirements and installation pages for your release.

How the Mautic web host, workers and database connect

The diagram starts at the browser and the public web host running Mautic, which serves tracking and form requests and the admin interface. Cron and messenger worker hosts run the same Mautic codebase and reach the database on a private network, not the public internet. The database host sits inside a trust boundary, and the firewall rules and TLS settings on each connection are what you should check before go-live.

Web, cron and messenger hosts reach the database only through a private network.

When to keep the database on a separate host

The first decision is whether the database runs on the same VPS as the Mautic application or on its own host. A single server is simpler to build, patch and restore, and it avoids network configuration between tiers. The cost is that the web application, cron jobs, queue workers and the database share one failure domain, one disk, one memory pool and one maintenance window. A runaway PHP process or a full disk can take the database down with the application. For a small instance with light traffic and a single operator, that trade-off is often acceptable. For an instance that sends regular campaigns or that a compliance team expects to recover independently, a separate host usually makes more sense.

A separate database host adds work that has to be planned before installation. The database listener must be reachable only from the Mautic servers, so you need firewall rules, a private network path where your provider offers one, and TLS for database connections if traffic leaves a trusted segment. Credentials for the Mautic database user must be stored and rotated outside the web root. The database host becomes a second system to patch, monitor and back up, with its own restore test. Confirm with your provider and your DBA how the database host will be patched without taking Mautic offline, and who owns each system in the on-call rota.

Cron jobs and queue workers change the database load more than page views do. Segment updates, campaign triggers and the broadcasts command all run as background processes that query and write contact and event tables, and a messenger consumer adds steady reads and writes when email is queued. Mautic's cron documentation says these jobs should be staggered, which means the database must absorb overlapping work from several processes at predictable times. Before installation, decide where the cron host, web host and worker host run, whether they share one codebase copy, and how many database connections each role may open. Those answers determine whether a separate database host is needed on day one or whether it is a planned step once contact volume grows.

How DeployOpen works on this

DeployOpen plans, builds and supports the Mautic database inside your own infrastructure, whether on a separate host in your cloud account, a data center or an air-gapped network. The work follows a written scope agreed before any changes are made to your database servers.

How we scope

  • Confirm the Mautic release line and the MySQL or MariaDB version it requires before choosing the database engine.
  • Agree in writing which host, network path, backup target and monitoring the database work covers.
  • Record table prefix, database user privileges and cron and queue access points so the boundaries are clear before build.

How we build

  • Create the database with InnoDB and a dedicated Mautic user limited to the privileges the installer and application need.
  • Place the database on a separate host, restrict network access to the Mautic web and worker servers, and enforce TLS where supported.
  • Test connection behavior, character set and collation settings, and the installer run against the chosen version before the database goes live.

How we hand over

  • Deliver a written runbook covering users, grants, table prefix, network rules, configuration file locations and version details.
  • Document the backup and restore steps for the database, with a restore test performed and its results recorded.
  • Walk your database and platform teams through the configuration so they can review, change and audit it independently.

How we support

  • Offer ongoing support and upgrade planning as a retainer, covering database version changes tied to Mautic release lines.
  • Review database privileges, patch levels and backup jobs on a schedule agreed in the retainer scope.
  • Plan database work ahead of each Mautic upgrade so the supported MySQL or MariaDB version is confirmed before the change window.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.