Support Online
Skip to main content

Establishing a Connection to MySQL Database with phpMyAdmin

phpMyAdmin is a powerful and practical tool for managing MySQL databases via a web interface.
In this guide, you will learn how to install phpMyAdmin on Ubuntu and connect it securely via SSL to a Managed MySQL Database Cluster.

What Will You Learn in This Guide?

  • Installing phpMyAdmin on Ubuntu VPS
  • Enable phpMyAdmin on Apache
  • Add SSL certificate for Managed MySQL Cluster
  • Configure phpMyAdmin with secure connection
  • Manage multiple databases from a single panel

Prerequisites

Before starting the installation, ensure that the following components are ready:

  • Ubuntu 20.04+ VPS (sudo power user and UFW enabled)
  • Managed MySQL Database Cluster on GenixNode or similar provider
  • (Optional) Domain name (to access phpMyAdmin over HTTPS)

Step by Step Installation


1. Installing phpMyAdmin and Apache

1.1 Update package list

sudo apt update

Refreshes the package information on the server.

1.2 Install phpMyAdmin


sudo apt -y install phpmyadmin

1. Installs phpMyAdmin and its dependencies.

  • During installation:

  • apache2 → is selected as the web server.

  • dbconfig-common → No

Because we don't want to install local MySQL; We will connect to external Managed MySQL.


2. Update Apache Configuration

Open the configuration file to introduce phpMyAdmin to Apache:


sudo nano /etc/apache2/apache2.conf
  • Allows you to edit Apache main configuration.

1. Add the following line to the bottom of the file:


Include /etc/phpmyadmin/apache.conf

Save and exit.

3. Copying Managed Database SSL Certificate

You need a CA certificate to establish a secure connection to your managed MySQL database.

1. Download the CA certificate from the administration panel.

  • Generally the file name is ca-certificate.crt.

2. Import the certificate to the server


scp İndirilenler/ca-certificate.crt kullanici@sunucu-ip:/etc/phpmyadmin

Transfers files from the local computer to the server.

4. Editing phpMyAdmin Configuration

1. Open the config.inc.php file:


sudo nano /etc/phpmyadmin/config.inc.php

phpMyAdmin adjusts server connection settings.

2. Add the following sample link information to the bottom of the file:


$i++;
$cfg['Servers'][$i]['host'] = 'ornek-vt-kume.db.genixnodecloud.com';
$cfg['Servers'][$i]['port'] = '25060';
$cfg['Servers'][$i]['ssl'] = true;
$cfg['Servers'][$i]['ssl_ca'] = '/etc/phpmyadmin/ca-certificate.crt';

Remarks

  1. $i++; → Adds a new database profile to phpMyAdmin.

  2. host: Your managed database address

3rd port: Special connection port determined by the provider

  1. ssl / ssl_ca: SSL authentication to encrypt the connection

  2. If you want to connect more than one database, you can copy this block and rearrange it below.


5. Restart Apache and Test the Connection


sudo service apache2 restart

Restarts the Apache service.

  • Open the following address in the browser:

http://alan-adiniz-veya-ip-adresiniz/phpmyadmin
  • Log in with managed MySQL username and password. You can now manage your databases from the phpMyAdmin panel.

Frequently Asked Questions (FAQ)

1. Why is SSL mandatory when using a Managed Database? Since data is transported over the internet, SSL prevents data from being intercepted by encrypting all traffic.

2. Why did we say No in dbconfig-common? Because we do not want phpMyAdmin to create a database on its own server; We will connect to remote MySQL.

3. Can I manage multiple MySQL clusters from a single panel? Yes. Just add one more block in config.inc.php.

4. I am getting an error while logging in. What could be the reason? It usually happens due to wrong hostname, port, lack of IP whitelisting or faulty SSL path.

5. Is it mandatory to include the server IP in database access? Yes. Managed databases allow specific IPs for security reasons.


Result

You have now completed the installation of phpMyAdmin on your Ubuntu server and learned how to establish a secure connection with SSL to your Managed MySQL Database cluster. In this way, you can manage your databases through a modern and easy interface without using the command line.

Don't forget to review GenixNode solutions for database performance and security.