RE:NODE

Connect your app to a database on Renode

The two kinds of database on RE:NODE - database slots on app and web plans, and database hosting servers - where the host, port and password are shown, and how to connect from Node.js and Python without committing credentials.

All docs pages

There are two kinds of database on RE:NODE, and they are reached differently.

Database slotDatabase hosting server
What it isA MySQL-compatible database the panel creates for an app or web serverA whole server running PostgreSQL, MySQL, MongoDB, Microsoft SQL Server or Valkey
Where it is createdThe Databases tab of your app or web serverBought as its own server
Connection detailsHost, port, database and username on the Databases tabThe server's address and port, shown in the panel
PasswordOn the Databases tabA Startup tab variable on the database server

Database slots#

App and web plans include database slots. On the server's Databases tab, create a database and the panel generates its host, username and password - nothing is shared with anybody else's server. The tab shows the host, port, database name and username; the password is revealed there too (you need the permission to view it if you are a subuser). Open in phpMyAdmin signs you straight into that database.

Database hosting servers#

A database server runs its engine, started by its image. There is no application code to deploy to it. Connect from your app using the database server's address and port as shown in the panel. Its superuser or root password is generated when the server is created and lives in a variable on that server's Startup tab - copy it from there.

The engine's major version is fixed by the server's image and cannot be downgraded: a newer major changes the on-disk format, and an older one refuses to open it.

Keep the credentials out of the code#

Connection settings belong in the app's environment, never in its repository. Put them in a .env uploaded through the Files tab of the app server, or in Startup tab variables:

.env (uploaded through the Files tab, never committed)
DB_HOST=the-host-from-the-panelDB_PORT=3306DB_NAME=s12_appDB_USER=u12_abc123DB_PASSWORD=copied-from-the-databases-tab

The values above are placeholders - use the ones the panel shows for your database. Commit a .env.example with the same keys and no values.

Connecting from Node.js#

With mysql2 for a database slot or a MySQL server:

db.js
require("dotenv").config();const mysql = require("mysql2/promise");const pool = mysql.createPool({  host: process.env.DB_HOST,  port: Number(process.env.DB_PORT),  database: process.env.DB_NAME,  user: process.env.DB_USER,  password: process.env.DB_PASSWORD,});module.exports = pool;

With pg for a PostgreSQL server, the same values as one connection string:

javascript
const { Pool } = require("pg");// DATABASE_URL=postgres://user:password@host:port/databaseconst pool = new Pool({ connectionString: process.env.DATABASE_URL });

Connecting from Python#

db.py
import osimport pymysqlfrom dotenv import load_dotenvload_dotenv()connection = pymysql.connect(    host=os.environ["DB_HOST"],    port=int(os.environ["DB_PORT"]),    database=os.environ["DB_NAME"],    user=os.environ["DB_USER"],    password=os.environ["DB_PASSWORD"],)

For PostgreSQL use psycopg with a DATABASE_URL; for MongoDB, pymongo with a mongodb:// URI built from the same environment values.

Notes per engine#

  • Microsoft SQL Server is the Express edition. In SSMS and most drivers the server name is host,port - with a comma. Express limits each database to 10 GB.
  • Valkey is the open-source fork of Redis and speaks the Redis protocol, so Redis clients connect to it. It is password-protected.
  • MySQL database servers come with a root password, an application database and an application user, all generated.

Checklist#

  • No password, host or connection string is written into the code or committed.
  • The app reads its connection settings from the environment and fails clearly when one is missing.
  • The password was copied from the Databases tab (slots) or the Startup tab (database servers).
  • A linked repository on a database server holds migrations or seed files, not something to execute.

Common errors#

Access denied. The password was mistyped or has a stray quote in .env. Copy it again from the panel.

Connection refused or timed out. The host or port is wrong - use exactly what the panel shows. localhost is never right for a database on another server.

`database files are incompatible with server`. A database server's data directory was opened by a different major version. Majors cannot be switched on an existing server, and there is no downgrade - open a support ticket rather than changing the image again.

Questions this does not answer? Open a ticket from the panel, or start from the overview. These pages are also available as plain text for AI assistants at /llms.txt.