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

 

 

MySQL: Relational Database Server

bullet Introduction

MySQL is the original and still one of the most popular open-source relational database servers, used to store the structured data behind content management systems, forums, and web applications of every kind.

On a GSP VPS, the recommended default database is MariaDB — an open-source fork of MySQL, created by MySQL's original authors, that is highly compatible and what most application documentation now assumes. The two share the same SQL dialect, the same mysql/mysqldump client commands, and the same wire protocol, so the instructions on the MariaDB page apply almost verbatim. Install MySQL specifically only when an application or vendor calls for Oracle's MySQL by name.

 

bullet Installing MySQL

If you do need Oracle's MySQL rather than MariaDB, connect to your VPS, become root, and install it. Check the available versions first with pkg search mysql or dnf module list mysql, since several major versions are usually offered.

On FreeBSD 15:

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

On Rocky Linux 10:

# dnf install mysql-server
# systemctl enable --now mysqld
# mysql_secure_installation

NOTE: MariaDB and MySQL both provide a service commonly called mysql and both install a mysql client command. Install one of the two, not both — they conflict over the same data directory, port (3306), and command names.

 

bullet Creating a Database and User

The administrative steps are identical to MariaDB. Give each application its own database and a dedicated user, and never use the database root account in an application's configuration file. Connect with 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;

From PHP, connect through the mysqli or PDO extensions exactly as for MariaDB. On Rocky Linux, if the application reaches the database over TCP, allow Apache to make the connection with setsebool -P httpd_can_network_connect_db on.

 

bullet Backups

Dump the database to a SQL file rather than copying its data files while the server runs:

$ mysqldump myapp > myapp-`date +%F`.sql     # back up
$ mysql myapp < myapp-2026-01-31.sql         # restore

Schedule it from cron and copy the result off the VPS, following the routine on the Server Maintenance page.

 

bullet Web Administration with phpMyAdmin

phpMyAdmin is a web-based administration tool for MySQL and MariaDB. 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 MySQL 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 mysql(1) and mysqldump(1) manual pages cover the client tools. Full reference manuals are online for both engines:


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