Manually upgrade phpMyAdmin

How to Manually Upgrade phpMyAdmin

Last updated on

Since the release of Ubuntu 18.04 and other Linux distros, many people have been having compatibility issues with PHP 7.2 and phpMyAdmin 4.6. In this article we will manually download and install the latest version of phpMyAdmin to resolve these issues.

1. Back up phpMyAdmin

You should back up your current phpMyAdmin folder by renaming it.

sudo mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin.bak

Create a new phpMyAdmin folder

sudo mkdir /usr/share/phpmyadmin/

Change to directory

cd /usr/share/phpmyadmin/

2. Download and Extract phpMyAdmin

Visit the phpMyAdmin download page and look for the .tar.gz URL and download it using wget. In this guide we are using version, released June 2019. If a later version is now available, make sure to change the commands below to match (and let me know in the comments so I can update the guide 😉).

sudo wget

Now extract

sudo tar xzf phpMyAdmin-

Once extracted, list folder


You should see a new folder phpMyAdmin-

We want to move the contents of this folder to /usr/share/phpmyadmin

sudo mv phpMyAdmin-* /usr/share/phpmyadmin

You can now log back into phpMyAdmin and check the current version. You may also see two errors:

phpMyadmin blowfish secret error and tempdir not writable error

3. Edit vendor_config.php

If you are seeing an error The $cfg[‘TempDir’] (./tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.

Open vendor_config.php

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

Press CTRL + W and search for TEMP_DIR

Change line  to

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

You may also see an error The configuration file now needs a secret passphrase (blowfish_secret). The blowfish secret is used by phpMyAdmin for cookie authentication. Blowfish secret

Press CTRL + W and search for CONFIG_DIR

Change line to

define('CONFIG_DIR', '/etc/phpmyadmin/');

phpMyAdmin will now generate its own blowfish secret based on the install directory.

Save file and exit. (Press CTRL + X, press Y and then press ENTER)

Now log back in to phpMyAdmin and ensure the errors are gone.

4. Cleanup

You can now delete the tar.gz file and the empty folder.

sudo rm /usr/share/phpmyadmin/phpMyAdmin-
sudo rm -rf /usr/share/phpmyadmin/phpMyAdmin-

And if you’re certain your new phpMyAdmin install is working correctly you can delete the backup folder.

sudo rm -rf /usr/share/phpmyadmin.bak


MySQL Backups

Are you backing up your MySQL databases? I’ve written a detailed guide on how to automatically dump and archive databases using mysqldump and cron:

Let me know in the comments if this helped. Follow me on Twitter, Facebook and YouTube.

p.s. I increased my AdSense revenue by 68% using AI 🤖. Read my Ezoic review to find out how.

1 Star2 Stars3 Stars4 Stars5 Stars 4.99 (240 votes)

Leave a Reply

Your email address will not be published. Required fields are marked *

We use Markdown to style comments, like on Github and Reddit.
To do a line break, type two spaces after the sentence.
You can add inline code by wrapping it in backticks: `code here`

    To do an entire block of code  
    type four spaces before the line
    and it will appear in a block like this.
    <-- four empty spaces

269 replies

Peope were looking for this solution on other websites, a lot of wrong or temporary answers that leads to other errors, but this article… Awesome, thanks!

Glad i made a backup.
the new phpmyadmin is only giving me a white screen (even tried copying the did not help)
so change the dir to and renamed the backup folder back to phpmyadmin
but with the old one i also had a blowfish error
this define(‘CONFIG_DIR’, ‘/etc/phpmyadmin/’); is giving an error 500 when changed in the vendor config file

Thanks for this.
Do you also have a solution where, once logged out, you can’t immidiately log-in again? I have to wait some time like an hour or so. I can’t find a good solution for that.


This was excellent – clearly written and bang up to date and all worked smoothly and well. Thank you so much!

THANK YOU!! I have seen and tried to follow so many TUT’s, and too often they’re missing some final step, or outdated, or just not helpful. Within minutes my annoying MYSQL server has morphed into an error free and comfortable environment in which we can work.

Really, excellent job!

I encountered multiple errors after installing the default PhpMyAdmin version 4.6.6.deb5 that came with my Ubuntu 18.04 distribution. Your guide solved them all in one fell swoop. Excellent instructions and many thanks!

It would have been absolutely possible to figure that out, but this fine turn-by-turn manual sped up the whole operation in the most pleasant way.

T H A N K _ Y O U very much

How to automate this on a simple script:

$ nano

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

echo "Getting lastest PHPMyAdmin version..."
mkdir /usr/share/phpmyadmin/
cd /usr/share/phpmyadmin/
tar xzf phpMyAdmin-
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-
rm -rf /usr/share/phpmyadmin/phpMyAdmin-
rm -rf /usr/share/phpmyadmin.bak

echo "Done!"

It didn’t work for me.
Getting this work
The $cfg[‘TempDir’] (./tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.

This was happening to me too. I figured out it was a permissions problem. Here’s what solved it for me, use at your own risk (make sure not to include the $, it just shows the line is a command):

$ cd /var/lib/phpmyadmin
$ sudo chmod 775 tmp

Perfect solution! Thanks! You might mention that, for Steps 2 and 4, the substring “all-languages” can be replaced with “english” in any command with that substring. The installation will then be a bit lighter, without the several MB of language files that are not needed when it’s known that only the English interface will be used.

works perfectly on ubuntu 18.10.
It seems that the phpmyadmin package on ubuntu isn’t tested before it released on apt.
Yet another reason for me to move to Arch..

Worked great! For some reason the copy past of the wget command did not work. I had to copy the URL from the website to download it. Same version you used though.

Todo el tutorial ha funcionado muy bien ; pero tengo este mensaje:
El almacenamiento de la configuración de phpMyAdmin ha sido desactivado.

Just for future visitors, to me it said newer version is 4.8.5 at current date.
I did the same operations using 4.8.5 instead of 4.8.4 and it worked like a charm.
Thanks for your help really!

The best guide. I like the step by step as I’m noob in this server setting.

My PHPMyAdmin is working now! Yeay! Thanks a lot!

Accurate, simple and straight to the point. This is how every guide should be done. A very good job, mate! Thanks a lot!

Nice guide!
thanks for work.

i hav got a warning after proccess this guide:
” Auf das $cfg[‘TempDir’] (./var/lib/phpmyadmin/tmp/) kann nicht zugegriffen werden.”
=> access denied.
But i hav chown usr “www-data” & grp “www-data”.

Worked like a champ. Excellent directions. This is Jan 1, 2019 and they still haven’t updated the repositories! Thanks for putting this together.

You probably missed the second edit :

where he changes:
define(‘CONFIG_DIR’, ‘ ‘);

define(‘CONFIG_DIR’, ‘/etc/phpmyadmin/’);

I did reinstall mysql and phpmyadmin multiple times in my raspberry pi ubuntu 18.04 server. phpmyadmin still had issues, but this manual totally helped. Many thanks

After a few months of aggravating error messages you solved the problem! This worked just as you said and is wonderful!!!!!! Can’t thank you enough.

please help, i have mysql 8, php 7.2.7
i installed phpmyadmin 4.6.6 and i had this errors, so i upgraded to 4.8.3 like you did but the errors still exists.
please help

The phpMyAd*min configuration storage is not completely configured,
some extended features have been deactivated. Find out why. Or
alternately go to ‘Operations’ tab of any database to set it up
there. Open new phpMyAdmin window.
mysqli_real_connect(): (HY000/1045): Access denied for user
‘phpmyadmin’@’localhost’ (using password: YES).
Connection for controluser as defined in your configuration failed.*

Thanks, excellent. Just a problem : the automatically generated blowfish secret phrase was too short : 24 chars, yet 32 needed. Modified in var/lib/phpmyadmin/ (Raspbian)

I have read tens of guides for Linux and no one was so simple and useful. I’d want to all guides was like this. Thank you.
(sorry for my English, i’m not a native speaker)

Thank you, i really appreciate your tutorial. The errors have been bugging me for a while, now all is fixed. Best regards and keep up the good work.

Within the created DIR "/usr/share/phpmyadmin" is a file calles “”.
Open it, add a 32char alphanumeric string as value of “cfg[blowfish_secret]” and safe it as “”.

While in the editing of


DO NOT replace

"define('CONFIG_DIR', '');" by "define('CONFIG_DIR', '/etc/phpmyadmin/');".

Instead take the path to the just altered “”. Take care, (maybe) because of the updating-process, there are minimum 2 other “” on your system under
1) “/var/lib/phpmyadmin” (is empty)
2) “/etc/phpmyadmin/” which will load the “blowfish”-file from “/var/lib/phpmyadmin”.

In my case it was just possible to satisfy the error-message when pointing to “/usr/share/phpmyadmin/” with filled “blowfish_secret” as “CONFIG_DIR”.

Finally, thank you very much for this guide.

There is an easier method to get rid of that error. Open /usr/share/phpmyadmin/libraries/vendor_config.php, search for CONFIG_DIR and change it to:

define('CONFIG_DIR', '/etc/phpmyadmin/');

A quicker fix for the blowfish_secret :

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

Press CTRL + W and search for CONFIG_DIR

Change line to:
define(‘CONFIG_DIR’, ‘/etc/phpmyadmin/’);

Wonderful straight forward, easy to follow write up. Very well done. And most importantly, thank you for posting this tip to fix this issue for Ubuntu 18.04 users! (Not that it matters as it’s the same Ubuntu as in pure Linux, but implemented this fix in Windows Subsystem for Linux – Ubuntu 18.04)

All I can recommend is that you restore your backup.

sudo mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin.del

sudo mv /usr/share/phpmyadmin.bak/ /usr/share/phpmyadmin

Check that phpMyAdmin is working again.

Yo realice todos los pasos pero me dejo un warning que dice
El archivo de configuración ahora necesita una frase secreta (blowfish_secret).

Buscando como arreglaro, edite el archivo config.default.php y en la linea $cfg[‘blowfish_secret’]=’ColocarValorAleatorio’

$cfg[‘blowfish_secret’] = ‘a0sfo49nadf89fa3s8f789sf78asb7p1587balz’

segun esto se tiene que colocar un valor aleatorio, no se si sea correcto esto, sin embargo a mi me funciono.

NOTA: para buscar la ubicacion del archivo
sudo find / -name config.default.php