Manually upgrade phpMyAdmin

How to Manually Upgrade phpMyAdmin

Last updated on

Whether your repository is too slow to deliver the latest version of phpMyAdmin or you are having compatibility issues with your current version, in this article we will manually download and install the latest version of phpMyAdmin.

Introduction

This guide has been tested from Ubuntu 20.10 to 16.04. It should also work for other Debian-based distributions without issue. For CentOS users, please refer to the comments section at the end of this page as commands will be different. I will try to update this guide for CentOS as soon as I get the chance to test it. In the meantime, if you have any suggestions on how to improve this guide, please let me know in the comments.

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

Update Feb 2020: phpMyAdmin 5 has been released but it is only compatible with PHP 7.1 and above. To find out your PHP version in command line, run php -v.

phpMyAdmin version 4.x is now in the LTS phase, where only security fixes and critical bug fixes are made. Users are advised to migrate to version 5 (read more).

  • For PHP 7.1 and above, download phpMyAdmin 5.x
  • For PHP 5.5 to PHP 7.4, download phpMyAdmin-4.9.7

Visit the phpMyAdmin download page and look for the .tar.gz URL and download it using wget. In this guide we are using version 5.1.0, released Feb 2021. 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 😉). If you are having issues with phpMyAdmin 5.x, try phpMyAdmin-4.9.7 instead.

sudo wget https://files.phpmyadmin.net/phpMyAdmin/5.1.0/phpMyAdmin-5.1.0-all-languages.tar.gz

Now extract

sudo tar xzf phpMyAdmin-5.1.0-all-languages.tar.gz

Once extracted, list folder

ls

You should see a new folder phpMyAdmin-5.1.0-all-languages

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

sudo mv phpMyAdmin-5.1.0-all-languages/* /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

/usr/share/phpmyadmin/libraries/vendor_config.php
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

/usr/share/phpmyadmin/libraries/vendor_config.php
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.

If you are seeing an error “The secret passphrase in configuration (blowfish_secret) is too short.”, see below.

If you are having issues with phpMyAdmin 5, try phpMyAdmin-4.9.7 instead as this is the latest stable release for PHP 7.0 and lower and MySQL 5.4 and lower.

4. Cleanup

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

sudo rm /usr/share/phpmyadmin/phpMyAdmin-5.1.0-all-languages.tar.gz
sudo rm -rf /usr/share/phpmyadmin/phpMyAdmin-5.1.0-all-languages

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

Hurrah!

Blowfish Secret Error “Too Short”

If you are seeing an error “The secret passphrase in configuration (blowfish_secret) is too short.”

Open blowfish_secret.inc.php:

sudo nano /var/lib/phpmyadmin/blowfish_secret.inc.php

Click here to generate a 32-character random phrase.

Copy it and paste it into blowfish_secret.inc.php.

/var/lib/phpmyadmin/blowfish_secret.inc.php
<?php
$cfg['blowfish_secret'] = '32_char_random_phrase_here';

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

1 Star2 Stars3 Stars4 Stars5 Stars 4.97 (312 votes)

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

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

Subscribe
Notify of
guest
454 Comments
newest
oldest
Inline Feedbacks
View all comments
Babakt
Babakt
1 day ago

Awsome!

Mutale
Mutale
1 day ago

This worked out like good for PHP 8.0.5 May – 2021
Thanks.

Jon
Jon
6 days ago

Awesome, this worked for me. Thank you!

william ache
william ache
12 days ago

Excelent thanks!

Arlindo Bento
Arlindo Bento
25 days ago

Excelent tutorial thanks!

ipang dwi - firstplato
ipang dwi - firstplato
27 days ago

bro, you are really save my time.. running flawlesly, thanks a lot.. I was implement it on my dev and production server..

Joe
Joe
1 month ago

Excellent instruction – works perfect on a Pi!

Deano
Deano
1 month ago

Awesome instructions, thanks.
I particulary like the way you give us both the exact syntax and a clear explanation about what we’re doing.

Daronna
Daronna
1 month ago

EXCELLENT, yes all in caps. It worked perfectly. Thank you so much

Jeff Long
Jeff Long
1 month ago

Thanks so much! Worked flawlessly.

Hachem
Hachem
1 month ago

Afte I make all the steps , I got connection refused to all my users

boodjel
boodjel
1 month ago

LIFE SAVER !!!!

Sherlock
Sherlock
1 month ago

Thank you a lot :+1:

Amine
Amine
2 months ago

Thank you so so much, you are a life saver and I wish you all the best 🙂

Pink
Pink
2 months ago

I never comment on stuff I read, but damn! Thanks dude.

neralex
neralex
2 months ago

Thank you, works every time!

ayied
ayied
2 months ago

OMG! Thank you so much for this, i can finally use phpmyadmin!

rika
rika
2 months ago

this works amazingly every time. thank you very much!

Andy
Andy
2 months ago

You should also consider to delete the default setup UI, it is a security risk.
Just delete the directory: /usr/share/phpmyadmin/setup/

Simon
Simon
2 months ago

There is a new version of phpmyadmin (5.1.0) released on 2021-02-24 🙂

Geraldine
Geraldine
2 months ago

Thanks a lot, it worked perfectly for me!

Anton
Anton
3 months ago

Thank you very much for that tutorial!

Jim
Jim
3 months ago

This is the first How-To I have followed to the letter that worked the first time in a long time! Thank you for the effort.

Tony
Tony
3 months ago

Fantastic. Did the job perfectly.

Darrik
Darrik
3 months ago

Fantastic instructions!

Peter Francis
Peter Francis
3 months ago

Thanks very much – worked a treat on Raspberry Pi OS (Buster).

Matt Wilson
Matt Wilson
3 months ago

upgrade process worked great, been fighting this for a while, and you saved me! well done!

Carlos Castro
Carlos Castro
4 months ago

Muchas gracias por el turorial!!

JHONATAN J J NUSS
JHONATAN J J NUSS
4 months ago

Funcionou perfeitamente

Paulo
Paulo
25 days ago

aqui o phpmyadmin nem carrega mais

sergio Saad
sergio Saad
4 months ago

just perfect
And really well detailed! Great Job

Mac Baret
Mac Baret
4 months ago

Awesome.

Worked and works like a charm.

Efficient tutorial.

JUST AWESOME OMG THANKS. ahah, sorry.

Raphael
Raphael
4 months ago

Thanks a lot!

ahmed
ahmed
5 months ago
thank you so much
vpougatchev
vpougatchev
5 months ago

That is a great tutorial. But in my case when trying to open phpMyAdmin, it gave me a Permission denier error. So I had to run chmod 777 /var/lib/php/session/ then it worked.

Chris
Chris
5 months ago

Very good. Thank you very much!

me_th
me_th
5 months ago

error
The $cfg[‘TempDir’] (/usr/share/phpmyadmin/tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.

Lars
Lars
5 months ago

Very nice guide! Thanks a lot!
Kudos and greetings from Germany!

Wong
Wong
5 months ago

This is the best tutorial ever I’ve followed online.

Erik
Erik
5 months ago

Thanks for the clear explaination..

Some Kudo’s for you!

Nikhil Gyan
Nikhil Gyan
5 months ago

Thanks a lot. This is great and life-saving for me.

kajdzo
kajdzo
5 months ago

Great walkthrough, thanks!

Robert
Robert
5 months ago

Thank you

Alex
Alex
5 months ago

This is just brilliant!
Thank you soo much.

Andrew
Andrew
5 months ago

Awesome! Case does matter though in centos it’s /usr/share/phpMyAdmin/

Robert
Robert
5 months ago

Worked all great! Thanks.

Jim
Jim
5 months ago

Thanks. Worked perfectly once I found MY typo!

Jim
Jim
5 months ago

Followed all steps and now phpmydamin just opens to a blank page. Rebooting made no difference.

Jim
Jim
5 months ago
Reply to  Jim

Resolved – it was a typo

D K
D K
5 months ago

Awesome tutorial!

Mohammad
Mohammad
6 months ago

Thank you so much!

Dimitris
Dimitris
6 months ago
thank you very much