You can also create a database on its own, without an app, and connect to it from your computer: see Create a Database on Its Own and Connect From Your Computer.
An app deployed from Git can have its own databases. FlyNode creates them next to the app, sets the connection variables for you, and keeps them private: by default they have no public address, and only your own apps on FlyNode can reach them. If you need to connect from your own computer you can turn on remote access, with a list of allowed addresses.
What you can add
- MySQL and MariaDB, for Laravel and similar apps.
- PostgreSQL, for Next.js with Prisma or Drizzle, Django and Rails.
- MongoDB, for the MERN stack.
- Redis, for cache, sessions and queues.
An app can use one SQL database (MySQL, MariaDB or PostgreSQL), plus MongoDB and Redis. Databases do not count toward your Workspace's app limit; they share its memory, CPU and storage. A database needs a Workspace with at least 1 GB of memory (512 MB for Redis).
Add one when you deploy
In the Custom app form, the Database section has a preset for common stacks (Laravel, Next.js, MERN, Django or Rails) and a checkbox for each database. Pick what your app uses and press Deploy. The databases are created first and their variables are set before the app starts, so the first build already has them.
Add one to a running app
Open the app, go to the Database tab and press the database you want. FlyNode creates it, sets the variables on your app and redeploys it.
The variables FlyNode sets
- MySQL, MariaDB, PostgreSQL:
DATABASE_URL,DB_CONNECTION,DB_HOST,DB_PORT,DB_DATABASE,DB_USERNAMEandDB_PASSWORD. - MongoDB:
MONGODB_URIandMONGO_URL. - Redis:
REDIS_URL,REDIS_HOST,REDIS_PORTandREDIS_PASSWORD.
Each database card on the Database tab also shows the host, port, user, password and database name. The host name only works from your own apps on FlyNode.
With Claude or the command line
- New app: add
--db postgresql(or another type) toflynode deploy. - App already running: tell Claude Add a PostgreSQL database to my-app.
- FlyNode sets the variables for you. The password is never shown in the chat.
Import a dump
On the database card, press Choose a file under Import a dump. The limit is 500 MB. The file is loaded in the background and the result appears under the button.
- MySQL and MariaDB: a
.sqlor.sql.gzfile frommysqldump. - PostgreSQL: a
.sql,.sql.gzor custom-format.dumpfile frompg_dump. It loads as one transaction, so a file that fails leaves the database as it was. - MongoDB: a
.archiveor.archive.gzfile frommongodump --archive. - Redis: a
.rdbor.rdb.gzfile (thedump.rdbof your old Redis, or one made withredis-cli --rdb). It replaces everything in the Redis, and the database is read-only for a short while during the copy.
Tick Replace everything in the database first to make the database match the file exactly. Without it the file is added to what is already there and may clash with existing tables.
Download a backup
Press Download to get a gzipped dump of the database, made at that moment. Keep it, or load it somewhere else with the database's own tools.
Backups
FlyNode backs up every database of your app each night, together with the app's files, and keeps the backups for up to 7 days. They are saved encrypted in Cloudflare R2 storage, away from your server. Open the app's Backup tab to see them, restore the database from one (choose Database only), or download the database of any backup as a compressed file.
Delete a database
Press Delete database on its card and confirm. The database and all its data are removed for good, and the app stops counting it. The variables stay on your app until you change or remove them.
Good to know
- A database is created with a fixed memory allowance (512 MB, or 256 MB for Redis). It shares your Workspace's RAM and CPU like your apps do.
- If your data is bigger than 500 MB, or you want to keep a managed service, deploy with No database and set the connection variables yourself.
Next steps
Still stuck?
Open a support ticket from your dashboard and include the container name.