Before you start
A paid plan: Free doesn’t create databases.
Enough free RAM: 1,024 MB for PostgreSQL, MongoDB and MySQL; 512 MB for Redis.
Step by step
1
Create the database
In the dashboard, click New Project, choose Database and pick the engine. It’s ready when
its status turns Online.
2
Collect host, port and password
All three are on the database page. The port is unique per database: never assume 5432,
27017, 6379 or 3306.
3
Download the certificates
In the Certificates tab, download the three files and rename them to something stable:
4
Ship the certificates with the application
Put the
certs/ folder in the project you upload. If you deploy from GitHub, add certs/ to
.gitignore and upload the folder through the application’s Files tab instead: the key
authenticates as you and must never live in a repository.5
Store the credentials as environment variables
In the application’s Config tab, add:Restart the application so the process sees them.
6
Connect
Read everything from the environment. PostgreSQL with Node.js:The same pattern for Python, MongoDB, Redis and MySQL is on the
Databases page.
Test from your machine first
The connection works the same from your computer, which is the fastest way to tell a code problem from a credential problem:Troubleshooting
Connection refused or timeout
Connection refused or timeout
Check the port on the database page and that the database is Online.
SSL or certificate errors
SSL or certificate errors
TLS must be on, and the three files must be the current ones. After Reset Certificates, the
old files stop working: download them again and redeploy them.
Authentication failed
Authentication failed
Copy the password again; after Reset Password, update
DB_PASSWORD and restart the app.
MongoDB also needs authSource=admin in the URI.ENOENT: no such file certs/db.pem
ENOENT: no such file certs/db.pem
The path is relative to the process’s working directory, the project root. Check the folder
exists in the Files tab.