Quick answer: Install MariaDB with sudo apt install mariadb-server (Ubuntu/Debian) or sudo dnf install mariadb-server (AlmaLinux/Rocky), enable it, then run sudo mysql_secure_installation to lock down defaults. MariaDB is a drop-in MySQL replacement shipped by most distributions.

Overview

Nearly every dynamic site needs a relational database. MariaDB, a community fork of MySQL, is the default in distro repositories and fully compatible with WordPress, WHMCS and most PHP apps. Oracle MySQL works the same way if your stack specifically requires it.

Before you start

  • Root/sudo access; 1 GB+ RAM recommended for small databases (check your disk space too).
  • Decide on a strong root DB password and per-application users.

Step-by-step guide

  1. Install and enable:
    # Ubuntu/Debian
    sudo apt -y install mariadb-server
    # AlmaLinux/Rocky
    sudo dnf -y install mariadb-server
    sudo systemctl enable --now mariadb
  2. Secure the installation (sets root password, removes test DB and anonymous users):
    sudo mysql_secure_installation
  3. Create an application database and user:
    sudo mysql
    CREATE DATABASE myapp CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    CREATE USER 'myapp'@'localhost' IDENTIFIED BY 'STRONG_PASSWORD';
    GRANT ALL PRIVILEGES ON myapp.* TO 'myapp'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;
  4. Verify: mysql -u myapp -p myapp.

Common issues

  • App can't connect: check user/password and that the app connects to localhost (or grant the right host).
  • Remote access needed: keep the DB closed to the internet where possible; if you must, bind carefully, firewall to a specific source IP and use strong passwords.
  • Out-of-memory on small VPS: tune innodb_buffer_pool_size down, or add swap.

When to contact support

Database administration is application-level work; reach us via ticket for platform issues (server down, disk faults) or to upgrade resources if the database outgrows the plan.

Frequently asked questions

Is MariaDB the same as MySQL?

MariaDB is a community fork of MySQL that stays drop-in compatible for typical applications. WordPress, WHMCS and most PHP software run on either without changes.

What does mysql_secure_installation actually do?

It sets a root password, removes anonymous users and the test database, and disables remote root login — closing the risky defaults of a fresh installation.

Should my database be reachable from the internet?

No. Keep it bound to localhost whenever possible. If remote access is unavoidable, firewall the port to one specific source IP and use strong unique passwords.

Related articles

Ready to get started? Order a VPS at Cloud2Y →

Was this answer helpful? 0 Users Found This Useful (0 Votes)