Database Architecture Overview
MongoDB (Primary)
Stores:
- User accounts and authentication
- Character data
- Inventory and items
- Player-specific data
- Logs and analytics
MySQL (Secondary)
Stores:
- Relational data
- Compatibility with other resources
- Persistent server data
- Structured records
Both databases are required. Mythic Framework will not start without both MongoDB and MySQL properly configured.
MongoDB Setup
MongoDB databases (
auth and fivem) are created automatically by Mythic Framework on first start. No manual database creation is required.MongoDB Connection String
The connection string tells Mythic Framework how to connect to MongoDB. Format:Enable MongoDB Authentication (Recommended)
For production servers, enable authentication:- Windows
- Linux
Edit Restart MongoDB service:
C:\Program Files\MongoDB\Server\6.0\bin\mongod.cfg:Test MongoDB Connection
Verify you can connect with your configured credentials:MySQL Setup
Create Database
Create the MySQL database for Mythic Framework:- MySQL Command Line
- phpMyAdmin (XAMPP Users)
- HeidiSQL
The database name
MythicFramework_345AE9 can be customized, but make sure it matches your server.cfg configuration.MySQL Connection String
The connection string format for oxmysql: Format:Test MySQL Connection
Verify your connection works:Configure server.cfg
Now update yourserver.cfg with the database connection strings.
Open server.cfg and find the database configuration section:
server.cfg
Verify Database Configuration
Let’s verify the databases are configured correctly before starting the server.MongoDB Verification
MySQL Verification
Database Initialization
On first server start, Mythic Framework will automatically:- Connect to both databases
- Create required collections (MongoDB)
- Create required tables (MySQL)
- Initialize default data
- Create indexes for performance
You don’t need to manually create tables or collections. The framework handles this automatically on first run.
Connection Troubleshooting
MongoDB Connection Failed
MongoDB Connection Failed
Common Issues:
-
MongoDB not running:
-
Wrong connection string:
- Check username/password
- Verify
authSource=adminif using authentication - Ensure database names match
-
Authentication error:
-
Firewall blocking:
MySQL Connection Failed
MySQL Connection Failed
Common Issues:
-
MySQL not running:
-
Wrong credentials:
-
Database doesn’t exist:
-
Host/port issues:
-
User doesn’t have privileges:
oxmysql Resource Errors
oxmysql Resource Errors
If oxmysql won’t start:
- Check connection string format is correct
- Verify resource exists:
resources/oxmysql/ - Ensure it’s started before mythic-base in resources.cfg
- Check console for specific error messages
Database Management Tools
MongoDB Compass
Best for:
- Viewing character data
- Debugging inventory issues
- Analyzing player statistics
- Running queries
mongodb://localhost:27017HeidiSQL / phpMyAdmin
Best for:
- Viewing relational data
- Debugging SQL queries
- Analyzing performance
- Managing users
localhost:3306Security Best Practices
Use Strong Passwords
Use Strong Passwords
- Minimum 16 characters
- Mix of uppercase, lowercase, numbers, symbols
- Don’t use default passwords
- Don’t reuse passwords from other services
Restrict Network Access
Restrict Network Access
- Only allow localhost connections if server and database are on same machine
- Use firewall rules to restrict database ports
- Never expose database ports to the internet
- Use VPN for remote database access
Regular Backups
Regular Backups
- Daily automated backups
- Test restore procedures
- Keep backups off-site or in cloud storage
- Backup before major updates
Monitor Database
Monitor Database
- Set up monitoring for connection errors
- Monitor disk space usage
- Track slow queries
- Set up alerts for unusual activity