Skip to main content
Glama
multi-database.mdx1.91 kB
--- title: "Multi-Database" --- Connect to multiple databases from a single DBHub instance using TOML configuration. Useful for: - Managing production, staging, and development databases - Working with databases across different cloud providers - Querying multiple database types simultaneously ## Configuration Create a `dbhub.toml` file: ```toml dbhub.toml [[sources]] id = "production" dsn = "postgres://user:password@prod.example.com:5432/myapp" readonly = true max_rows = 1000 [[sources]] id = "staging" dsn = "mysql://root:password@localhost:3306/myapp_staging" readonly = false max_rows = 5000 [[sources]] id = "local" dsn = "sqlite:///./dev.db" ``` Start DBHub: ```bash # Automatically loads ./dbhub.toml npx @bytebase/dbhub --transport http --port 8080 # Or specify custom location npx @bytebase/dbhub --config=/path/to/config.toml ``` See [Server Options](/config/server-options) for detailed option descriptions. ## Examples <Tabs> <Tab title="Using DSN"> ```toml [[sources]] id = "production" dsn = "postgres://user:pass@prod.example.com:5432/myapp" readonly = true max_rows = 1000 [[sources]] id = "staging" dsn = "mysql://root:pass@localhost:3306/myapp_staging" ``` </Tab> <Tab title="Individual Parameters"> ```toml [[sources]] id = "production" type = "postgres" host = "prod.example.com" port = 5432 database = "myapp" user = "app_user" password = "p@ss:word" # No URL encoding needed readonly = true ``` </Tab> <Tab title="With SSH Tunnel"> ```toml [[sources]] id = "production" dsn = "postgres://user:pass@db.internal:5432/myapp" ssh_host = "bastion.example.com" ssh_user = "deploy" ssh_key = "~/.ssh/id_rsa" readonly = true ``` </Tab> </Tabs> <Note> The first `[[sources]]` entry is the default database used when no `id` is specified. </Note>

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bytebase/dbhub'

If you have feedback or need assistance with the MCP directory API, please join our Discord server