Supported databases
- SQLite: Default, built-in (no configuration needed)
- PostgreSQL: Version 17 and compatible versions
- MySQL: Version 8 and compatible versions
Migrating between databases
Usenpx convex export to export your data before moving from one database provider to another:
PostgreSQL setup
Using Neon (recommended)
Neon provides managed PostgreSQL with automatic scaling and branching.Set the POSTGRES_URL environment variable
Extract the connection string without the database name and query parameters:This should result in a URL ending in
neon.tech:Using local PostgreSQL
For local development:Custom database names
The database name is derived from your instance name (with- replaced by _):
.env
MySQL setup
Using PlanetScale
PlanetScale provides managed MySQL with Vitess.Create a database on PlanetScale
Create a database named
convex_self_hosted in the PlanetScale dashboard.Get the connection string
Copy the connection string from PlanetScale. Do not include the database name in
MYSQL_URL.Using local MySQL
For local development:Database naming conventions
The Convex backend connects to a database with the same name as your instance:- Default instance name:
convex-self-hosted - Default database name:
convex_self_hosted(hyphens replaced with underscores)
INSTANCE_NAME environment variable:
.env
Connection string format
PostgreSQL
POSTGRES_URL should NOT include the database name or query parameters:
MySQL
MYSQL_URL should NOT include the database name or query parameters:
Verification
After configuring your database, verify the connection:Troubleshooting
Connection errors
If you see connection errors in the logs:- Verify the connection string: Ensure it doesn’t include the database name or query parameters
- Check region/latency: Ensure your backend is in the same region as your database
- Verify SSL settings: Use
DO_NOT_REQUIRE_SSL=1only for local development - Check firewall rules: Ensure your hosting platform can access your database
Database not found
If you see “database not found” errors:- Verify database exists: Check that you created the database with the correct name
- Check instance name: Ensure the database name matches your instance name (with hyphens replaced by underscores)
- Verify permissions: Ensure your database user has access to the database
Performance issues
- Check latency: Use
pingor similar tools to measure latency between backend and database - Same region: Ensure backend and database are in the same region
- Connection pooling: Managed services typically handle this automatically
Example configurations
Production with Neon PostgreSQL
.env
Production with PlanetScale MySQL
.env
Local development with PostgreSQL
.env
Next steps
Storage
Configure S3-compatible storage for files and exports
Configuration
Explore all runtime configuration options