How to Manually Upgrade phpMyAdmin on Ubuntu 20.04

This tutorial explains how to upgrade phpMyAdmin on Ubuntu 20.04 when you already installed phpMyAdmin through the apt package manager.

The phpMyAdmin installation from the APT package manager creates multiple directories as follows:

  • /etc/phpmyadmin – Configuration files
  • /var/lib/phpmyadmin – Library and tmp directories
  • /usr/share/phpmyadmin – Main phpMyAdmin installation directory

Step 1: Backup Your Current phpMyAdmin

When upgrading your phpMyAdmin instance, you should take a backup of your current phpMyAdmin installation directory. An easy way to do this is to simply rename the folder in the same location.

sudo my /usr/share/phpmyadmin/ /usr/share/phpmyadmin.bak

Step 2: Download the Latest phpMyAdmin

You can download the latest copy of the phpMyAdmin archive file from its official download page using the command below.

sudo wget www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip
sudo unzip phpMyAdmin-latest-all-languages.zip

Once downloaded, you will see a directory named like phpMyAdmin-[CURRENT_VERSION]-all-languages in the current directory. Now we need to move this latest folder to the appropriate location.

sudo mkdir /usr/share/phpmyadmin
sudo mv phpMyAdmin-*/* /usr/share/phpmyadmin/

Step 3: Update the phpMyAdmin Configuration

Since the existing phpMyAdmin was installed via the APT package manager, we need to specify the appropriate TEMP_DIR and CONFIG_DIR location under the vendor_config.php file.

The values should look the same as the screenshot below:

To do so, edit the vendor_config.php file in your favorite text editor like vim or nano. I prefer to use nano editor.

sudo nano /usr/share/phpmyadmin/libraries/vendor_config.php

The following TEMP_DIR and CONFIG_DIR values need to be updated in the vendor_config.php file like below:

define('TEMP_DIR', '/var/lib/phpmyadmin/tmp/');
define('CONFIG_DIR', '/etc/phpmyadmin/');

Now, save the vendor_config.php file and access phpMyAdmin in a web browser. It should load up as expected like below.

Leave a Comment