This question was asked previously, How to upgrade PHPmyAdmin

The answer given was

sudo apt-get update
sudo apt-get install phpmyadmin


sudo apt-get update
sudo apt-get upgrade

The version of phpmyadmin included in apt-get is 4.5.4, which was released January 28 2016.

In a response to this question one answer was to use use the phpMyAdmin archive which offers the following commands.

sudo add-apt-repository ppa:phpmyadmin/ppa
sudo apt-get update

In my case that updated a lot of things, but, not specifically phpmyadmin, I needed the additional command

sudo apt-get install phpmyadmin

This did successfully get past the version which was released in 2019.

As of this writing it does seem that manually downloading and copying using the vague instructions from docs.phpmyadmin.net is required.

Is there a more current repository for phpmyadmin than the PPA or is a manual install required?

  • 2
    @Rinzwind, It's currently at version 4.5.4 and I'd like it to be the current version of 4.7.3, how is that not and upgrade? Commented Aug 21, 2017 at 6:52

12 Answers 12


@Photo Larry pretty much hit the nail on the head! I am going to give an answer based on his that will be easy to understand and follow.

  • Your first step is to install PMA (phpMyAdmin) from the official Ubuntu repo: apt-get install phpmyadmin.
  • Next, cd into usr/share directory: cd /usr/share.
  • Third, remove the phpmyadmin directory: rm -rf phpmyadmin.
  • Now we need to download the latest PMA version onto our system (Note that you need wget: apt-get install wget):
wget -P /usr/share/ "https://files.phpmyadmin.net/phpMyAdmin/4.8.2/phpMyAdmin-4.8.2-english.zip"

Let me explain the arguments of this command, -P defines the path and "the link.zip" is currently (7/17/18) the latest version of PMA. You can find those links HERE.

  • For this next step you need unzip (apt-get install unzip): unzip phpMyAdmin-4.8.2-english.zip. We just unzipped PMA, now we will move it to it's final home.
  • Lets use the cp (copy) command to move our files! Note that we have to add the -r argument since this is a folder. cp -r phpMyAdmin-4.8.2-english phpmyadmin.
  • Now it's time to clean up: rm -rf phpMyAdmin-4.8.2-english.

Keep Reading!

You might now notice two errors after you log into PMA.

the configuration file now needs a secret passphrase (blowfish_secret). phpmyadmin
The $cfg['TempDir'] (./tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.

However, these issues are relatively easy to fix. For the first issue all you have to do is grab your editor of choice and edit /usr/share/phpmyadmin/config.inc.php but there's a problem, we removed it! That's ok, all you have to do is: cd /usr/share/phpmyadmin & cp config.sample.inc.php config.inc.php.

Example phpMyAdmin Blowfish Secret Variable Entry:

 * This is needed for cookie based authentication to encrypt password in
 * cookie
$cfg['blowfish_secret'] = '{^QP+-(3mlHy+Gd~FE3mN{gIATs^1lX+T=KVYv{ubK*U0V'; 

Now save and close the file.

  • Now we will create a tmp directory for PMA: mkdir tmp & chown -R www-data:www-data /usr/share/phpmyadmin/tmp. The last command allows the Apache web server to own the tmp directory and edit it's contents.

EDIT Dec 12, 2018

You don't want someone to steal your cookies, now do you?

It has been brought to my attention that https://www.question-defense.com/tools/phpmyadmin-blowfish-secret-generator causes errors on older versions on PMA. However, the main reason I discourage you to use websites like this is because you have no idea whether they use a weak PRNG (Pseudo-Random Number Generator) (e.g. rand(), mt_rand(), and lcg_value()) or one of the "shuffling" functions (e.g. str_shuffle(), shuffle(), array_rand()). As such, I made my own tool for this purpose. It generates a cryptographically secure 32 character string you can use without concern for security or errors! PHP man page for function I use to generate the randomness http://php.net/manual/en/function.random-int.php. I replaced the old link with this one: https://www.motorsportdiesel.com/tools/blowfish-salt/pma/.

EDIT Sep 11, 2020

I have changed the blowfish generator link as the old one is no longer reachable.

  • Nice gidelines! I've followed them with few side steps: a) instead of removing the old version, I'd rename it; b) it may be handy to create symbolic link phpmyadmin, which can be easily switched between multiple versions.
    – AntonK
    Commented Nov 6, 2018 at 22:56
  • I have copied your answer here as I think is the best option. If you want to make your own answer, tell me and I'll remove mine.
    – PhoneixS
    Commented Dec 10, 2018 at 12:35
  • 2
    Seems like salt generator is not accessible :( Commented Dec 26, 2019 at 7:56
  • 2
    Almost correct, except that you left the ZIP file in the directory
    – Raptor
    Commented Sep 16, 2020 at 7:44
  • 1
    Been having a problem with phpmyadmin since my original spin up of an EC2. This fixed all issues for me. I blindly followed your steps and was not disappointed.
    – fischgeek
    Commented Feb 15, 2021 at 20:32

I just had to do this because of issues with php7.2 and receiving the error count(): Parameter must be an array or an object that implements Countable.

The version from apt was 4.5.4 and the ppa does not have the fixes for php7.2. My solution was to download the latest version from https://www.phpmyadmin.net/ and copy the files to /usr/share/phpmyadmin.

  • 1
    worked for me like a charm Commented Feb 18, 2018 at 0:27
  • OK, much better now! Debian (and Ubuntu) should upgrade their packages. Ps. I'm even running PHP 7.3. Commented Dec 27, 2018 at 3:29

The current top answer is very good but a little too complex. Here I rewrite the procedure into a more concise one. It assumes you are working in a safe dir like home.

  1. Back up the existing config:
cp /usr/share/phpmyadmin/config.inc.php .
  1. Download the latest phpMyAdmin (or other version):
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-english.tar.xz
  1. Delete the current installation:
find /usr/share/phpmyadmin -mindepth 1 -delete
  1. Extract the downloaded archive instead of old installation:
tar xf phpMyAdmin-latest-english.tar.xz --strip 1 -C /usr/share/phpmyadmin
  1. Replace config:
cp config.inc.php /usr/share/phpmyadmin
  1. [optional] Clean up your working directory:
rm config.inc.php phpMyAdmin-latest-english.tar.xz

Edit 2020: realized we can easily preserve config.

  • Nice and easy. Thanks! Commented Nov 10, 2022 at 18:29
  • Thank you! For me it was necessary to run "sudo service apache2 restart"
    – Oleg
    Commented Aug 15, 2023 at 9:37

As stated above, you need to update the files manually but I searched for an hour to find out where these were located (/usr/share) and kept seeing that it was going to be placed into /var/www/html which is incorrect. If you installed the software with apt-get install phpmyadmin after adding the repository above which claims to be current, then you at least get the php7.2 libs needed. Then you need to install the NEW version (4.8) into /usr/share/phpmyadmin by going to the /usr/share and cloning the git: git clone https://github.com/phpmyadmin/phpmyadmin.git (I did rm -rf phpmyadmin first) just to be sure no old code was left. Then when going into the web interface....you see the newest version is now being used. Then be sure to cd to phpmyadmin and run : composer update --no-dev This gets the added libraries needed. This installs 4.9.0-dev which runs great and I am running Ubuntu 16.04.4. Thanks hope this helps someone save time

  • Thank you!, this saved my day! but I decided to use the stable one github.com/blackmambano5/phpmyadmin.git this is version 4.8.1 and everything works!
    – RicardO
    Commented Jun 11, 2018 at 15:12
  • Thanks, this helped. I installed from zip, not from Github, not much difference there. I suggest editing the question to break the large paragraph into a list of steps.
    – pgr
    Commented Jul 6, 2018 at 10:20
  • Better fetch the latest stable version from git like this: git clone -b STABLE https://github.com/phpmyadmin/phpmyadmin.git. Commented May 9, 2019 at 21:07

Following the instructions found here, I created this simple script to update PHPMyAdmin to the last stable version:

echo "Backing up"
mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin.bak

echo "Getting lastest PHPMyAdmin version..."
mkdir -p /usr/share/phpmyadmin/
cd /usr/share/phpmyadmin/
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
tar xzf phpMyAdmin-latest-all-languages.tar.gz
mv phpMyAdmin-*/* /usr/share/phpmyadmin

echo "Updating vendor_config"
sed -i -r "s/('TEMP_DIR'\s*,)[^\)]*/\1 '\/var\/lib\/phpmyadmin\/tmp\/'/" /usr/share/phpmyadmin/libraries/vendor_config.php
sed -i -r "s/('CONFIG_DIR'\s*,)[^\)]*/\1 '\/etc\/phpmyadmin\/'/" /usr/share/phpmyadmin/libraries/vendor_config.php

echo "Cleaning up..."
rm /usr/share/phpmyadmin/phpMyAdmin-latest-all-languages.tar.gz
rm -rf /usr/share/phpmyadmin/phpMyAdmin-*
rm -rf /usr/share/phpmyadmin.bak

echo "Done!"
  • Thanks man, nice script
    – Taavi
    Commented Nov 8, 2021 at 20:30

You can simply manually install the latest version of phpmyadmin.

Head over to https://www.phpmyadmin.net/downloads and download the latest version but make sure you have the compatible PHP and MySQL version as listed on the website.

Extract it to your server public folder and edit the config.inc.php file. Make sure your auth_type is cookie and host is whatever your host is. This setting will make you enter your username and password when logging in.

/*Authentication type*/
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['host'] = 'localhost';

Crimson501's answer is perfect unless your on Ubuntu, in order to fix the blowfish and tmp file issue on ubuntu you need to modify the following file, to reference the existing config, and tmp directory that ubuntu uses.

Using your favorite text file editor modify:

modify './tmp/' to '/var/lib/phpmyadmin/tmp/'
modify '' to '/etc/phpmyadmin/'
save the changes

Now when you go back and refresh the page the errors will be gone.


I would use the phpMyAdmin archive if you really need the latest version. Mind though that there is a dependency (you need a newer php too):

PPA description

Latest phpMyAdmin packages - https://www.phpmyadmin.net/. Based on packages available in Debian.

There are some notable changes:

  • 2
    I think he asked how to update it to latest version, not where the install can be downloaded.
    – Tarik
    Commented Jan 6, 2018 at 18:37
  • 1
    In July 2018, that PPA is still at 4.6.6 (with the bug) while phpMyAdmin is at 4.8 (without the bug). Looks like the PPA is no longer maintained?
    – Steve
    Commented Jul 2, 2018 at 0:07
  • Just used this PPA -- 4.9.0, not too bad -- latest is 4.9.1. Makes life simple. Did have to upgrade the PHP to 7.3
    – nrapopor
    Commented Oct 9, 2019 at 4:24

You can now use the phpMyAdmin PPA

https://launchpad.net/~phpmyadmin/+archive/ubuntu/ppa (sudo add-apt-repository ppa:phpmyadmin/ppa)

Source: https://github.com/phpmyadmin/phpmyadmin/issues/15236#issuecomment-502392098 (the debian repository issue/discussion)

The ppa:nijel has been deleted

  • The repository does not have a Release file, therefore disabled by default.
    – Raptor
    Commented Sep 16, 2020 at 7:33
  • It only works for bionic and eoan. Commented Sep 16, 2020 at 9:44

I would advise to use Docker to run the latest phpmyadmin. It's simple to set up and all dependencies are automatically managed and don't interact with your local install. It uses 25MB of RAM so it's also not a memoryhog.

Very easy to run the latest phphmyadmin on whichever platform.



About the script proposed by @garsax :

with phpmyadmin v5.2.0 there's no more TEMP_DIR nor CONFIG_DIR in /usr/share/phpmyadmin/libraries/vendor_config.php

So you could replace the sed commands with those :

sed -i -r "s/ROOT_PATH . 'tmp' . DIRECTORY_SEPARATOR/'\/var\/lib\/phpmyadmin\/tmp' . DIRECTORY_SEPARATOR/" /usr/share/phpmyadmin/libraries/vendor_config.php
sed -i -r "s/ROOT_PATH . 'config.inc.php'/'\/etc\/phpmyadmin\/config.inc.php'/" /usr/share/phpmyadmin/libraries/vendor_config.php
sed -i -r "s/ROOT_PATH . 'config.header.inc.php'/'\/etc\/phpmyadmin\/config.header.inc.php'/" /usr/share/phpmyadmin/libraries/vendor_config.php
sed -i -r "s/ROOT_PATH . 'config.footer.inc.php'/'\/etc\/phpmyadmin\/config.footer.inc.php'/" /usr/share/phpmyadmin/libraries/vendor_config.php


Thanks @unseult for providing updates for phpmyadmin v5.2.0. I need this version to fix a break on the user permissions screen with mysql 8.0.11.

I have consolidated a set of upgrade commands that are necessary for the latest version. The commands from @garsax did not work and so I am using parts of the script from @džuris.

# Upgrade phpmyadmin on Ubuntu 20.04.5. Works with phpmyadmin 5.2.0+.

wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-english.tar.xz

# update the /usr/share/phpmyadmin because we could get a 
# permission error removing or moving it.
find /usr/share/phpmyadmin -mindepth 1 -delete
tar xf phpMyAdmin-latest-english.tar.xz --strip 1 -C /usr/share/phpmyadmin

# Replace some paths in /usr/share/phpmyadmin/libraries/vendor_config.php
# note: There is no file /usr/share/phpmyadmin/config.inc.php. 
#       It should be provided by ubuntu package in /etc/phpmyadmin.
sed -i -r "s/ROOT_PATH . 'tmp' . DIRECTORY_SEPARATOR/'\/var\/lib\/phpmyadmin\/tmp' . DIRECTORY_SEPARATOR/" /usr/share/phpmyadmin/libraries/vendor_config.php
sed -i -r "s/ROOT_PATH . 'config.inc.php'/'\/etc\/phpmyadmin\/config.inc.php'/" /usr/share/phpmyadmin/libraries/vendor_config.php
sed -i -r "s/ROOT_PATH . 'config.header.inc.php'/'\/etc\/phpmyadmin\/config.header.inc.php'/" /usr/share/phpmyadmin/libraries/vendor_config.php
sed -i -r "s/ROOT_PATH . 'config.footer.inc.php'/'\/etc\/phpmyadmin\/config.footer.inc.php'/" /usr/share/phpmyadmin/libraries/vendor_config.php

rm phpMyAdmin-latest-english.tar.xz

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .