If you prefer a Graphical User Interface (GUI) over the command line, you can configure phpMyAdmin to connect to your remote Cloud Database.
This guide covers the setup for a Clean VPS (AlmaLinux 9) and a cPanel Server.
- A Cloud Database instance (IP/Hostname, Username, Password).
- Root access to your VPS.
- Firewall: Ensure your VPS IP is whitelisted in the Cloud Database firewall settings.
Scenario A: Clean VPS (AlmaLinux 9)
Step 1: Install Dependencies
Update your system and install the Apache web server, PHP, and the EPEL repository.
sudo dnf update -y
sudo dnf install httpd php php-mysqli php-json epel-release -y
Start the web server:
sudo systemctl enable httpd --now
Step 2: Install phpMyAdmin
Now install the application from the EPEL repo:
sudo dnf install phpmyadmin -y
Step 3: Configure Apache Access
By default, phpMyAdmin blocks external access. You need to allow your IP (or all IPs) to access the interface.
1. Open the config file:
sudo vi /etc/httpd/conf.d/phpMyAdmin.conf
2. Locate the blocks <Directory /usr/share/phpMyAdmin/> and <Directory /usr/share/phpMyAdmin/setup/>.
3. Change Require local to Require all granted (or restrict to your specific IP for better security).
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
</Directory>
Step 4: Configure Remote Database Connection
Now we tell phpMyAdmin to connect to the Tilaa Cloud Database instead of (or alongside) localhost.
1. Open the main configuration file:
sudo vi /etc/phpmyadmin/config.inc.php
2. Modify the server configuration array. You can replace the existing block with this logic:
<?php
declare(strict_types=1);
/* GENERATE A RANDOM 32-CHAR STRING FOR THIS! */
$cfg['blowfish_secret'] = 'k1721093812093812093812093812381';
$i = 0;
/* Server 1: Tilaa Cloud Database */
$i++;
$cfg['Servers'][$i]['host'] = 'your-cloud-db-hostname.tilaa.cloud'; // Replace with your endpoint
$cfg['Servers'][$i]['port'] = ''; // Default 3306
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['Servers'][$i]['verbose'] = 'Tilaa Cloud DB'; // Name shown in dropdown
/* Server 2: Localhost (Optional) */
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['verbose'] = 'Local Database';
?>
Step 5: Firewall & SELinux (Critical)
AlmaLinux uses SELinux, which prevents the web server from making outside network connections by default.
1. Allow Remote DB Connections (SELinux):
sudo setsebool -P httpd_can_network_connect_db 1
2. Open Firewall Ports (HTTP/HTTPS):
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
Step 6: Restart & Test
sudo systemctl restart httpd
Visit http://your-vps-ip/phpMyAdmin. You should see a "Server" dropdown to choose between your Cloud Database and Localhost.
Scenario B: cPanel Server
cPanel has its own internal phpMyAdmin installation. We can inject the Cloud Database configuration there.
config.inc.php.
Step 1: Edit Configuration
Open the internal phpMyAdmin config:
sudo vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php
Step 2: Add Remote Server
Find the $cfg['Servers'] array and append your Cloud Database configuration. Ensure you keep the existing "Local" configuration intact so cPanel itself keeps working.
/* Existing cPanel Config above... */
/* ADD THIS BLOCK FOR CLOUD DB */
$i++;
$cfg['Servers'][$i]['host'] = 'your-cloud-db-hostname.tilaa.cloud';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['Servers'][$i]['verbose'] = 'Cloud Database';
Step 3: Restart cPanel Services
/scripts/restartsrv_httpd
/scripts/restartsrv_cpsrvd
Now, when you open phpMyAdmin from WHM or cPanel, you should see the option to switch servers.