Database Requirements
MongoDB
Version: 3.6.6 or higher
Purpose: Primary database — two separate databases for auth and game data
Required: YES
MySQL
Version: 5.7 or higher (MariaDB 10.2+)
Purpose: Inventory persistence, compatibility layer
Required: YES
MongoDB Configuration
Mythic requires 4 separate convars for two MongoDB databases:| Convar | Purpose | Example Value |
|---|---|---|
mongodb_auth_url | Auth DB connection string | mongodb://localhost:27017/... |
mongodb_auth_database | Auth DB name | auth |
mongodb_game_url | Game DB connection string | mongodb://localhost:27017/... |
mongodb_game_database | Game DB name | fivem |
Basic Connection (Development)
Authenticated Connection (Production)
Both databases can share the same MongoDB server and credentials — they are just different database names within the same MongoDB instance.
Connection String Parameters
Connection String Parameters
| Parameter | Description | Example |
|---|---|---|
username | Database username | mythic_user |
password | Database password | SecurePassword123 |
host | MongoDB server address | localhost, 192.168.1.100 |
port | MongoDB port | 27017 (default) |
authSource | Authentication database | admin |
readPreference | Read preference | primary |
ssl | Enable SSL/TLS | true or false |
Remote & Cloud MongoDB
Remote & Cloud MongoDB
Remote Server:MongoDB Atlas (Cloud):Atlas uses
mongodb+srv:// protocol for automatic DNS resolution. The database name is set separately via the mongodb_auth_database and mongodb_game_database convars.What Each Database Stores
- Auth Database
- Game Database
Database name:
auth| Collection | Data |
|---|---|
accounts | Player accounts, identifiers, roles |
bans | Ban records |
Creating MongoDB User
MongoDB Troubleshooting
Connection Refused
Connection Refused
Error:
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017Solutions:Authentication Failed
Authentication Failed
Error:
MongoError: Authentication failedSolutions:- Verify credentials are correct
- Ensure
authSource=adminis in the connection string - Verify user has roles for both
authandfivemdatabases:
Database Not Found
Database Not Found
MongoDB creates databases automatically on first write. The
auth and fivem databases will be created when the framework first starts and inserts data.MySQL Configuration
Connection String
Mythic uses oxmysql with a standard MySQL connection string:The default database name is
MythicFramework. Always use charset=utf8mb4 for proper character support.Connection String Components
| Component | Description | Example |
|---|---|---|
username | MySQL user | root, mythic_user |
password | MySQL password (optional for root@localhost) | SecurePassword123 |
host | MySQL server | localhost, 192.168.1.100 |
port | MySQL port (default 3306, can be omitted) | 3306 |
database | Database name | MythicFramework |
Common Configurations
Slow Query Warning
oxmysql can warn you about slow queries:Creating MySQL Database and User
- Command Line
- phpMyAdmin
MySQL Troubleshooting
Access Denied
Access Denied
Error:
Access denied for user 'username'@'host'- Verify username and password
- Check user exists:
SELECT User, Host FROM mysql.user; - URL-encode special characters in passwords:
Unknown Database
Unknown Database
Error:
Unknown database 'MythicFramework'Create it:Too Many Connections
Too Many Connections
Increase MySQL max connections:Or reduce oxmysql connection limit in the connection string:
Complete server.cfg Example
Production Checklist
MongoDB
- Authentication enabled with strong password
- User has readWrite + dbAdmin roles on both
authandfivem - Connection strings include
authSource=admin - Firewall configured (port 27017)
- Regular backups configured
MySQL
- Strong password set (not root with no password)
- User limited to
MythicFrameworkdatabase utf8mb4charset used- Firewall configured (port 3306)
- Regular backups configured
Next Steps
Server Configuration
Complete server.cfg settings guide
Database Architecture
Learn how Mythic uses databases internally
Resource Management
Configure resource load order
Troubleshooting
Common setup issues and fixes