Victus Cloud / Support
APP HOSTING

Connect to your database

Use the host, port, name, user and password from the Victus panel Databases tab to connect from PHP, Node.js, Python or an external MySQL client.

Once you have created a database (see "Create a database"), you connect to it with the credentials shown in the Databases tab. The same five values — host, port, database name, username, password — work everywhere: framework config files, code, or a desktop client like MySQL Workbench, DBeaver or TablePlus.

Use the panel host, not localhost

Copy the exact host and port the Databases tab shows. Only use localhost if the panel explicitly indicates the database runs on the same host as your app.

From PHP

<?php
$pdo = new PDO(
  'mysql:host=YOUR_DB_HOST;port=3306;dbname=YOUR_DB_NAME',
  'YOUR_DB_USER',
  'YOUR_DB_PASSWORD'
);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

From Node.js

import mysql from 'mysql2/promise';

const db = await mysql.createConnection({
  host: process.env.DB_HOST,
  port: Number(process.env.DB_PORT) || 3306,
  user: process.env.DB_USER,
  password: process.env.DB_PASSWORD,
  database: process.env.DB_NAME,
});

From Python

import os, pymysql

conn = pymysql.connect(
    host=os.environ['DB_HOST'],
    port=int(os.environ.get('DB_PORT', 3306)),
    user=os.environ['DB_USER'],
    password=os.environ['DB_PASSWORD'],
    database=os.environ['DB_NAME'],
)

From an external client

  1. Open MySQL Workbench, DBeaver or TablePlus.
  2. Create a new MySQL connection using the host, port, user and password from the Databases tab.
  3. If the panel restricted the database to a specific host, edit its allowed-connections value to % (or your IP) before connecting remotely.
  4. Test the connection, then browse the database.
Connection refused or access denied?

Double-check host/port are the panel values (not localhost), that the password matches exactly (reset it if unsure), and that remote connections are allowed for that database. Access-denied almost always means a wrong user/password or the user is not permitted from your IP.

Was this article helpful?

Still stuck?

Our team can help with your account or service.

Open a ticket →