Directus: Connecting Directus to a MySQL or MariaDB database

This documentation is part of the External databases guide. You can view the complete guide here: How to connect Directus to a MySQL, MariaDB, or PostgreSQL database.

👋 Welcome to the Stackhero documentation!

Stackhero offers a Directus cloud service, ready to use in production, in just 2 minutes:

  • Unlimited collections, items, users, roles, API requests, and transfers
  • Customizable domain name secured with HTTPS (for example, https://cms.your-company.com)
  • Dedicated and unlimited email server included
  • Redis cache server included for high performance
  • Optimal performance and robust security powered by a private and dedicated VM.
  1. One-click updates for effortless maintenance

Save time and simplify your life: it only takes 5 minutes to try Stackhero's Directus cloud solution!

  1. First, create a user for Directus on MySQL or MariaDB. Open phpMyAdmin and navigate to User accounts followed by Add user account.

  2. Provide a username (for example, directus). Set a secure password by clicking the Generate button, choose Native MySQL authentication, and check Create database with same name and grant all privileges.

    Directus user creation on a MySQL/MariaDB databaseDirectus user creation on a MySQL/MariaDB database

  3. Next, log in to your Stackhero dashboard. Select your Directus service and click Configure.

  4. In the configuration panel under Database, choose MySQL/MariaDB and complete the remaining fields as shown in the screenshot below.

    Configuration of MySQL/MariaDB for DirectusConfiguration of MySQL/MariaDB for Directus