GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
* Sign Up! *

Support
Customer Portal
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

MariaDB: Relational Database Server

bullet Introduction

MariaDB is a widely-used, open-source relational database server, and the database most PHP applications — WordPress, forums, e-commerce platforms — document first. It began as a drop-in replacement for MySQL, created by MySQL's original developers, and remains highly compatible: the same SQL, the same client commands, and the same on-the-wire protocol. On both FreeBSD 15 and Rocky Linux 10, MariaDB is the relational database GSP recommends for new sites.

If your application specifically asks for Oracle's MySQL, see the closely-related MySQL page — almost everything below applies to both.

 

bullet Installation

Connect to your VPS, become root, install the server and client, start it, and run the bundled hardening script. (Package versions move over time — a quick pkg search mariadb or dnf search mariadb confirms the current names.)

On FreeBSD 15:

# pkg install mariadb123-server mariadb123-client
# sysrc mysql_enable=YES
# service mysql-server start
# mysql_secure_installation

On Rocky Linux 10:

# dnf install mariadb-server mariadb
# systemctl enable --now mariadb
# mariadb-secure-installation

The secure-installation script walks through setting a root password for the database server (a separate concept from your VPS's own root account), removing anonymous accounts, and disabling remote root login — all sensible defaults for a single-server setup.

 

bullet Creating a Database and User

Give each application its own database and a dedicated user. Never put the database's root account into an application's configuration file. Connect with the client — mariadb (or mysql) as root — and run:

CREATE DATABASE myapp;
CREATE USER 'myapp'@'localhost' IDENTIFIED BY 'choose-a-strong-password';
GRANT ALL PRIVILEGES ON myapp.* TO 'myapp'@'localhost';
FLUSH PRIVILEGES;

The application then connects as myapp to the myapp database on localhost. Keeping the database bound to localhost (its default) means it is reachable only from the VPS itself, not the open Internet — the right posture for a typical single-server site.

 

bullet Connecting from Your Application

Most PHP applications talk to MariaDB through PHP's mysqli or PDO extensions, which you install alongside PHP (php84-mysqli on FreeBSD, php-mysqlnd on Rocky Linux). In the application's configuration you will typically supply four things — host (localhost), database name, user, and password — matching what you created above.

On Rocky Linux, SELinux blocks Apache from opening network connections by default. A local database socket is fine, but if your app connects to MariaDB over TCP (including 127.0.0.1), allow it once:

# setsebool -P httpd_can_network_connect_db on

 

bullet Backups

A database is not captured usefully by a plain file copy while the server is running; dump it to a SQL file instead. mariadb-dump (also available as mysqldump) writes a complete, restorable snapshot:

# Back up one database
$ mariadb-dump myapp > myapp-`date +%F`.sql

# Restore it
$ mariadb myapp < myapp-2026-01-31.sql

Schedule the dump from cron and copy the result off the VPS as part of the routine on the Server Maintenance page, so a database failure never costs you more than a day's data.

 

bullet Web Administration with phpMyAdmin

phpMyAdmin is a web-based administration tool for MariaDB and MySQL. From a browser it lets you create and browse databases, run SQL, import and export data, and manage users — a friendly alternative to the command-line client. It is a PHP application, so it needs PHP and a running web server; set those up first using the Web Applications page.

On FreeBSD 15, install the package built for your PHP version (PHP 8.4 here). The files land in /usr/local/www/phpMyAdmin/, and you supply the configuration:

# pkg install phpMyAdmin5-php84
# cd /usr/local/www/phpMyAdmin
# cp config.sample.inc.php config.inc.php

Then add an alias to your Apache configuration so the directory is served, restricted to your own address:

Alias /phpmyadmin /usr/local/www/phpMyAdmin
<Directory /usr/local/www/phpMyAdmin>
    Require ip 203.0.113.0/24      # your network only
</Directory>

On Rocky Linux 10, phpMyAdmin is in the EPEL repository. Installing it also drops an Apache snippet at /etc/httpd/conf.d/phpMyAdmin.conf and the configuration at /etc/phpMyAdmin/config.inc.php:

# dnf install epel-release
# dnf install phpmyadmin
# systemctl restart httpd

That Apache snippet allows access only from the server itself by default, so add your own address to its Require rules (a line such as Require ip 203.0.113.0/24) and restart Apache.

Cookie logins need a 32-character secret; set it in config.inc.php:

$cfg['blowfish_secret'] = 'a-random-32-character-string....';

Now browse to https://your-domain/phpmyadmin/ and log in with a database user — the per-application account for everyday work, or the database root for administration. phpMyAdmin checks those credentials against MariaDB itself.

TIP: phpMyAdmin talks directly to your database, which makes it a high-value target. Serve it only over HTTPS, keep it limited to your own address (above), and patch PHP and phpMyAdmin as part of Securing Your VPS. If you need it only occasionally, leaving it uninstalled and using the command-line client is the safest option of all.

 

bullet Documentation

The mariadb(1) and mariadb-dump(1) manual pages cover the client tools. The project's Knowledge Base and the phpMyAdmin manual are both comprehensive:


Toll Free 1-866-GSP-4400 • 1-301-464-9363 • service@gsp.com
Copyright © 1994-2026 GSP Services, Inc.