What will you learn in this guide?
- ✓ How to create an isolated Managed Database for your project.
- ✓ How to retrieve the Connection String and inject it securely into your code.
- ✓ Understanding the logic of network isolation, legacy data imports, and migrations.
One of the most critical components of modern applications is the database. With Skyversal Managed Databases, you can create your MySQL or PostgreSQL database in seconds and connect it directly to your application. All Managed Database infrastructure is handled by Skyversal; installation, maintenance, updates, and backups are performed automatically by the platform, so you can focus solely on developing your product.
🛠️ 1. Creating a Database
Follow these steps in order to add a cloud database to your project:
| Engine | Use Case & Recommendations |
|---|---|
|
Managed PostgreSQL
v15.x / v16.x Supported
|
Recommended for modern SaaS applications, API services, and data-intensive systems. Provides high data consistency. |
|
Managed MySQL
v8.x Supported
|
Recommended for WordPress, classic PHP applications, and projects requiring high CMS compatibility. |
🔐 2. Retrieving Connection Credentials
Once your database transitions to the "Running" state, you need to retrieve the credentials to connect your project. Go to the database detail page in your Skyversal dashboard and click the copy icon in the "Connection URI" section.
Modern ORM tools (like Prisma, Drizzle, Eloquent, Sequelize, TypeORM, SQLAlchemy) accept the password, port, and username as a single string (URI):
postgres://username:password@host:5432/database
💻 3. Connecting to the Project (.env Injection)
You should never write this connection string directly into your source code (e.g., config.php). Instead, go to your project's Environment Variables (.env) tab and add a new variable like below:
DATABASE_URL=postgres://username:password@host:5432/database
If your framework does not support a single-line URI (like legacy Laravel or PHP projects), you can parse the Host, Port, Username, and Password from the connection string we provided and enter them separately as DB_HOST, DB_PORT, DB_USER, and DB_PASSWORD in your .env file. Don't forget to Re-deploy your project after adding them.
Ensure that your local .env file is in your .gitignore and is never committed to your GitHub/GitLab repository under any circumstances. Sensitive connection strings must never be shared in public source code. Skyversal stores your environment variables encrypted and never shares them outside of runtime.
🛡️ Private Networking
Skyversal Managed Database services are inaccessible from the internet by default. This architecture is the modern cloud platform security standard adopted to prevent production databases from being directly exposed to the internet.
- ✓ The direct brute-force attack surface is greatly eliminated as it is not open to the internet.
- ✓ Port scanning from the outside world is impossible.
- ✓ No Public IP is assigned.
- ✓ The database can only be used by your Skyversal projects in the same isolated network (VPC).
Skyversal Managed Database is designed for production environments. During local development, it is recommended to use a separate database running with tools like Docker, XAMPP, Laragon, or similar local instances.
📦 4. How to Transfer My Database? (Import & Migration)
Since your network is closed to the outside, you cannot directly connect to your Skyversal database with tools like HeidiSQL, DBeaver, or TablePlus on your computer. So how will you transfer your existing database tables or .sql file?
If you are using an ORM, add your table setup processes to your project's Build or Run commands. Every time your app deploys, your tables will be automatically created.
php artisan migrate --force
npx prisma migrate deploy
drizzle-kit migrate
If you have an existing .sql backup (dump), go to the database detail page in the Skyversal panel. Through Skyversal Database Explorer, you can securely run SQL queries and import supported file formats.
⚠️ Limit Warning: Web-based Database Explorer interfaces may have file upload size limits (e.g., 100MB). For giant dump files, you may prefer to write SQL import scripts within your application.
🎉 Everything is Ready!
Your database is now securely running on the private network, and your application is ready for the production environment. While backup, maintenance, updates, and infrastructure management are automatically handled by Skyversal, you can focus solely on developing your product.