Skip to content

Database URL Configuration Guide for MineBot

MineBot supports three types of database connections through SQLAlchemy's URL-based connection system. Each database type requires a specific format for proper connection.

Supported Database Types

MineBot supports three database engines:

Database TypeDescriptionBest For
SQLiteFile-based, lightweightDevelopment, small installations
MySQLServer-based, widely usedMedium-sized deployments
PostgreSQLServer-based, feature-richProduction, large deployments

Database URL Formats

1. SQLite

sqlite+aiosqlite:///path/to/database.db
  • Simple, file-based database
  • Ideal for development or small installations
  • The three slashes (///) indicate a relative path from the current directory
  • Example: sqlite+aiosqlite:///data/bot.db

2. MySQL

mysql+aiomysql://username:password@hostname:port/database_name
  • Server-based database requiring MySQL/MariaDB installation
  • Example: mysql+aiomysql://minebot_user:secure_password@localhost:3306/minebot_db

3. PostgreSQL

postgresql+asyncpg://username:password@hostname:port/database_name
  • Server-based database requiring PostgreSQL installation
  • Example: postgresql+asyncpg://minebot_user:secure_password@localhost:5432/minebot_db

Configuration

To configure your database connection:

  1. Edit the settings.json file in the configuration directory
  2. Update the database.url property with your chosen connection string:
json
"database": {
  "url": "your_database_url_here"
}

Security Considerations

Best PracticeDescription
Secure CredentialsStore database credentials in a safe location
Strong PasswordsUse complex passwords for database users
Least PrivilegeRestrict database user permissions to only what's necessary
Network SecurityFor remote databases, ensure proper firewall and access controls

Quick Reference

DatabaseDefault PortDriverURL Format Example
SQLiteN/Aaiosqlitesqlite+aiosqlite:///data/bot.db
MySQL3306aiomysqlmysql+aiomysql://user:pass@localhost:3306/db_name
PostgreSQL5432asyncpgpostgresql+asyncpg://user:pass@localhost:5432/db_name

Backup

  • Always back up your database before major changes
  • For production use, implement regular backup schedules