Plans from ₹99 a monthFree HTTPS on every site18% GST invoice with your GSTIN for input tax creditFull refund within 7 days of your first paymentPay yearly, get 2 months freeNo auto-renewal, everPlans from ₹99 a monthFree HTTPS on every site18% GST invoice with your GSTIN for input tax creditFull refund within 7 days of your first paymentPay yearly, get 2 months freeNo auto-renewal, ever

Databases

Create and connect to a database

Create a MariaDB database in the panel, save its password, and connect to it from PHP, WordPress or a Python app.

Beginner7 min readUpdated 27 October 2026

Learning path · step 12 of 20

On this page

Most dynamic websites keep their content in a database: WordPress posts, shop orders, user accounts. FiniteHost web hosting plans include MariaDB databases, a drop-in replacement for MySQL that works with WordPress and any PHP app written for MySQL.

Before you start#

  • Databases come with web hosting plans (Spark and above). Python compute and mail plans do not include databases.
  • The plan must be Active to create a database.
  • Have a safe place ready for the password, such as a password manager. It is shown only once.

How databases are named#

You choose a short name, and FiniteHost puts your subscription ID in front of it so names never clash between customers. The user name is the same as the database name.

You typeDatabase nameUser name
wordpresst3d2ca2b860_wordpresst3d2ca2b860_wordpress
shopt3d2ca2b860_shopt3d2ca2b860_shop

A name is 2 to 16 characters: lowercase letters, digits or _, starting with a letter.

Create a database#

  1. Open Databases in the panel sidebar under Data & files.
  2. Type a name in Create a database, for example wordpress.
  3. Click Create database.
  4. Copy the details from the Database created dialog: the database, the user and the password.
  5. Click I have copied it. The database shows as Being set up.
  6. Wait about a minute until its state changes to Ready. The page refreshes on its own.
The Databases page: your databases on the left, size, limits and connection details on the right.
The password appears once. Copy it before closing the dialog.

Connection details#

SettingValue
EngineMariaDB
Hostlocalhost
Port3306
Databaset3d2ca2b860_wordpress (yours, from the panel)
UserSame as the database name
PasswordThe one from the dialog
Character setutf8mb4 (collation utf8mb4_unicode_ci), so every language and emoji works

Databases are reachable only from your own websites and Python apps on FiniteHost, through localhost. You cannot connect from your own computer with a desktop tool such as MySQL Workbench or HeidiSQL: there is no remote database access. To move data in or out, see Import and export a database.

Connect from PHP#

Keep the password out of your public folder. Put the settings in a file next to public (see Folder layout), for example /sites/acme.in/private/db.php:

PHP
<?php
return [
    'host' => 'localhost',
    'name' => 't3d2ca2b860_shop',
    'user' => 't3d2ca2b860_shop',
    'pass' => 'paste-the-password-here',
];

Then connect with PDO, the recommended way:

PHP
<?php
$cfg = require __DIR__ . '/../private/db.php';
$pdo = new PDO(
    "mysql:host={$cfg['host']};dbname={$cfg['name']};charset=utf8mb4",
    $cfg['user'],
    $cfg['pass'],
    [
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    ]
);

$stmt = $pdo->prepare('SELECT name, price FROM products WHERE id = ?');
$stmt->execute([42]);
$product = $stmt->fetch();

Or with mysqli:

PHP
<?php
$cfg = require __DIR__ . '/../private/db.php';
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$db = new mysqli($cfg['host'], $cfg['user'], $cfg['pass'], $cfg['name']);
$db->set_charset('utf8mb4');

Connect from WordPress#

WordPress asks for these during installation, or you set them in wp-config.php:

PHP
define( 'DB_NAME', 't3d2ca2b860_wordpress' );
define( 'DB_USER', 't3d2ca2b860_wordpress' );
define( 'DB_PASSWORD', 'paste-the-password-here' );
define( 'DB_HOST', 'localhost' );
define( 'DB_CHARSET', 'utf8mb4' );

The full walk-through is in Install WordPress.

Connect from a Python app#

Python apps on a web hosting plan (Pro and above include apps) run on the same server as your databases, so they connect through localhost too. Add the driver to your app's requirements.txt:

Text
PyMySQL==1.1.1
Python
import pymysql

conn = pymysql.connect(
    host="localhost", port=3306,
    user="t3d2ca2b860_shop", password="paste-the-password-here",
    database="t3d2ca2b860_shop", charset="utf8mb4",
)
with conn.cursor() as cur:
    cur.execute("SELECT COUNT(*) FROM products")
    print(cur.fetchone()[0])
conn.close()

Python compute plans (Compute Nano to Large) have no databases. An app can store data in files inside its own folder instead, for example with Python's built-in sqlite3.

Troubleshooting#

  • Access denied for user: check the user name includes your subscription ID, and that you copied the whole password. If unsure, make a new password.
  • Unknown database: the database is still Being set up. Wait a minute for Ready.
  • Can't connect from my computer: that is expected; there is no remote access. Use a tool that runs on your site instead.
  • Too many connections or slow queries: see Database limits and passwords.

More fixes are in Database problems.

What's next#

Your progress is saved in this browser only.

Was this helpful?

Still stuck?

Email support@finitehost.com with your subscription ID (it starts with t, shown on the panel's Dashboard) and what you tried. A person replies, usually within one business day.

Last updated 27 October 2026. Found something wrong? Tell support@finitehost.com.