Database Configuration
Configure database settings for SigmaOrders.
Database Types
SigmaOrders supports two database types:
- SQLite (default) - File-based, no setup required
- MySQL - External database, better for large servers
SQLite Configuration
SQLite is the default and requires no additional configuration.
database:
type: SQLITE
SQLite Details
- File Location:
plugins/SigmaOrders/database.db - Setup: Automatic, no configuration needed
- Performance: Good for servers with < 200 players
- Limitations: Single-server only, file-based
SQLite Advantages
- Zero configuration
- No external dependencies
- Fast for small-medium servers
- Easy backups (just copy the file)
SQLite Disadvantages
- Slower with many concurrent operations
- File-based (can't share across servers)
- Limited scalability
MySQL Configuration
For larger servers or multi-server setups, use MySQL.
database:
type: MYSQL
mysql:
host: localhost
port: 3306
database: sigma_orders
username: root
password: your_password
pool-size: 10
MySQL Settings
| Setting | Type | Default | Description |
|---|---|---|---|
host | String | localhost | Database server hostname |
port | Integer | 3306 | Database server port |
database | String | sigma_orders | Database name |
username | String | root | Database username |
password | String | password | Database password |
pool-size | Integer | 10 | Connection pool size |
MySQL Setup Steps
-
Create Database
CREATE DATABASE sigma_orders CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -
Create User (optional, recommended)
CREATE USER 'sigmaorders'@'localhost' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON sigma_orders.* TO 'sigmaorders'@'localhost';
FLUSH PRIVILEGES; -
Configure Plugin
database:
type: MYSQL
mysql:
host: localhost
port: 3306
database: sigma_orders
username: sigmaorders
password: secure_password
pool-size: 10 -
Restart Server
- Plugin creates tables automatically
- Check console for connection success
MySQL Advantages
- Better performance for large servers
- Can share database across multiple servers
- Better concurrent operation handling
- Professional database management tools
MySQL Disadvantages
- Requires external database server
- More complex setup
- Additional resource usage
Connection Pooling
MySQL uses connection pooling for performance:
- pool-size: Number of concurrent connections (default: 10)
- Adjustment: Increase for high-traffic servers (max: 50 recommended)
- Monitoring: Check database connection count if issues occur
Database Migration
SQLite to MySQL
-
Backup SQLite Database
cp plugins/SigmaOrders/database.db database.db.backup -
Export Data (if needed)
- Use SQLite tools to export data
- Import to MySQL (manual process)
-
Change Configuration
database:
type: MYSQL
# ... MySQL settings -
Restart Server
- Plugin creates MySQL tables
- Old SQLite file can be kept as backup
warning
Data migration from SQLite to MySQL is not automatic. You may need to manually export/import data or start fresh.
Database Maintenance
SQLite Maintenance
- Backup: Copy
database.dbfile - Vacuum: SQLite auto-vacuums, but can be done manually if needed
- Size: Monitor file size (grows with orders)
MySQL Maintenance
- Backups: Use standard MySQL backup tools
- Optimization: Run
OPTIMIZE TABLEperiodically - Monitoring: Monitor connection pool usage
Troubleshooting
Connection Errors
Symptoms: "Failed to connect to database"
Solutions:
- Verify database server is running
- Check host/port settings
- Verify username/password
- Check firewall rules
- Test connection with MySQL client
Performance Issues
Symptoms: Slow order operations, timeouts
Solutions:
- Increase
pool-sizefor MySQL - Optimize database (indexes are auto-created)
- Consider MySQL for large servers
- Check database server resources
Permission Errors
Symptoms: "Access denied" errors
Solutions:
- Verify database user has proper permissions
- Check GRANT statements
- Verify database name is correct
Best Practices
- Use MySQL for 200+ players: Better performance
- Regular Backups: Backup database regularly
- Secure Passwords: Use strong passwords for MySQL
- Monitor Pool Size: Adjust based on server load
- Test Changes: Test database changes on dev server first
Next Steps
- Order Configuration - Configure order settings
- Performance Guide - Optimize database performance