When you download a production deployment package with a database option (PostgreSQL, MySQL, or MSSQL), the Docker Compose configuration already comes with the database fully set up and ready to run.
This guide explains how the database is initialized, how data is saved, and how to connect your MDriven Server to it.
Our provided Docker Compose setups explicitly define an internal network to ensure secure and seamless communication between your containers. (Note: If you are setting this up manually without our provided files, you must configure a shared network yourself for the applications to communicate).
- Database & MDriven Server: The database you choose is configured on the same network as the MDriven Server, allowing the server to connect to it securely without exposing the database to the public internet.
- MDriven Server & Turnkey: The MDriven Turnkey application is also placed on the same network as the MDriven Server so it can fetch the model and data it needs to run.
2. Initialization and Credentials
When you run docker compose up -d for the first time, the database schema is created automatically. Each database type has a specific folder in your deployment package containing its initialization scripts and credential files:
- MySQL (
databases/mysql)- Contains an
initfolder with the.sqlfile required to create the database schema. - Contains a
mysql.envfile where you set the credentials for the different user accounts the MDriven Server will use to connect.
- Contains an
- MSSQL (
databases/mssql)- Contains an
initfolder with the.sqlfile and bash scripts required to create the database schema. - Contains an
mssql.envfile where you set the credentials for the user account the MDriven Server will use to connect.
- Contains an
- PostgreSQL (
databases/postgres)- Contains an
initfolder with the.sqlfile required to create the database schema. - Contains a
postgres.envfile where you set the credentials for the different user accounts the MDriven Server will use to connect.
- Contains an
3. Data Persistence (Backups)
To ensure your data survives container restarts or updates, the database data files are mounted directly to your host machine. Depending on which database you chose, your data is safely backed up to the following host directories:
- PostgreSQL: Saved to
/postgres-data - MySQL: Saved to
/mysql-data - MSSQL: Saved to
/mssql-data
4. Connecting MDriven Server to the Database
Once your Docker setup is up and running, you need to point the MDriven Server application to your newly created database schema.
- Open your browser and navigate to your MDriven Server URL.
- Login to the interface.
- Navigate to Running > Model in the top menu.
- If the application is currently running, click Pause App.
- Change the Connection Type to match your chosen database (
MSSqlServer,MySQL, orPostgreSQL). - Set the Alternate Connection String by copying the exact string for your database below:
For MySQL:
Server=mysql;port=3306;Database=mdriven_db;Uid=mdriven;Pwd=123456;For PostgreSQL:
Server=postgres;port=5432;Database=mdriven_db;Uid=mdriven;Pwd=123456;For MSSQL:
Server=mssql,1433;Initial Catalog=mdriven_db;Persist Security Info=False;User ID=mdriven;Password=#MDs123456;MultipleActiveResultSets=False;Encrypt=False;TrustServerCertificate=False;Command Timeout=30;(Note: If you changed the default passwords in your .env files, make sure to update the Pwd or Password values in the connection strings above to match).
5. Finalize and Upload Model
- After setting the connection string, click Start App.
- You can now upload your model to the MDriven Server.
- To upload, you will use the password assigned to User 'a'.
(If you need to reset the password for User 'a', please refer to the Docker Compose Configuration Settings section on the Docker Overview page).
6. Viewing and Managing Your Database (External Tools)
If you want to view the created schemas, run custom queries, or manage your database data directly from your host machine, you can use specialized database client software (GUI tools).
Universal Database Tools (Recommended)
If you want one tool that can connect to any of the databases (MySQL, PostgreSQL, or MSSQL), we recommend:
DBeaver (Free and Open Source)
DataGrip (Commercial, by JetBrains)
Database-Specific Tools
If you prefer tools specifically designed for your chosen database engine:
- For MySQL: MySQL Workbench
- For PostgreSQL: pgAdmin
- For MSSQL: SQL Server Management Studio (SSMS) or Azure Data Studio
Connection Tip: When connecting from these external tools on your host machine, do not use the Docker internal names (mysql, postgres, mssql). Instead, use 127.0.0.1 (or your server's public IP) as the Host/Server, and connect using the exposed external port defined in your compose.yaml file along with the credentials set in your .env files.
