14

I have an old phpMyAdmin installation (contains my training and jobs data). I want to update it to the latest version and I want to keep my data safe while updating it. Is there any way to do it by running some commands on the terminal? Is my data erased if I uninstall phpMyAdmin?

Cave Johnson
  • 6,499
  • 5
  • 38
  • 57
assikk ajah
  • 153
  • 1
  • 1
  • 7

5 Answers5

20

Here is how to upgrade/downgrade on Ubuntu.

Note: The following instruction only works if you previously (and correctly) installed phpMyAdmin with the command line and use APACHE as a web server.

I suppose that you already have a working phpMyAdmin, but the version isn't the one you want. For instance, Ubuntu is shipping the 4.6.x version which doesn't work properly with PHP 7.2.

  1. Check the version you want on:

    https://www.phpmyadmin.net/files/

  2. On your server

    cd /usr/share/
    rm -rf phpmyadmin
    

    then adapt this line with the correct version number

    wget https://files.phpmyadmin.net/phpMyAdmin/4.8.0/phpMyAdmin-4.8.0-all-languages.zip
    unzip phpMyAdmin-4.8.0-all-languages.zip
    rm phpMyAdmin-4.8.0-all-languages.zip
    mv phpMyAdmin-4.8.0-all-languages phpmyadmin
    

    Note: If unzip don't work, install it with: sudo apt-get install unzip

  3. Check permissions

    Now you should be good.

    The owner of /usr/share/phpmyadmin should be root:root on a default installation. This should be fine but if you face some permissions issues, you can try to let Apache be the owner:

    # only if you have permissions issues
    chown -R www-data:www-data /usr/share/phpmyadmin
    chmod -R 755 /usr/share/phpmyadmin
    

    You can also restart Apache

    sudo service apache2 reload
    
  4. Troubleshooting

    Note: Depending on your PHP version, you may need to install additional libraries.

    For example, to resolve the error about missing mysqli and mysql extensions (update the command to reflect your PHP version):

    sudo apt-get install php5.6-mysql
    
Cave Johnson
  • 6,499
  • 5
  • 38
  • 57
Kaizoku Gambare
  • 3,143
  • 3
  • 29
  • 41
  • 2
    If - after finishing the above steps you get a "blowfish" or "count" error, follow the steps here to see if it resolves the issue: https://stackoverflow.com/questions/49246107/phpmyadmin-errors-count-blowfish-etc-after-php7-2-upgrade-on-ubuntu-16 – Robodashy May 19 '18 at 09:15
  • 1
    I don't think you need to `chown` everything to `www-data`. I have everything in `/usr/share/phpmyadmin` owned by root:root, with just the `tmp` folder having `www-data` as group (still owned by root). `www-data` doesn't need write access to anything but the `tmp` folder, I beleive. 775 for `tmp` (and subdirectory `twig`), then www-data can read/write everything it needs. – Buttle Butkus Dec 16 '20 at 02:08
  • Hi @ButtleButkus, you are right it works by default with root:root. As I said this is just in case you face permissions issues. I updated my answer making it more clear that this is optional. When you talk about tmp do you mean /tmp ? In my case /tmp is owned by root:root and it seems safer to me to change ownership of /usr/share/phpmyadmin than /tmp. I'm not a security expert, so if I'm wrong I'll be glad to update my answer. Thx for you comment anyway – Kaizoku Gambare Dec 16 '20 at 11:05
16

phpmyadmin is mysql client, so it will not affect your database if you uninstall phpmyadmin. I update phpmyadmin by using terminal commands:
First you have to add repository to get phpmyadmin :

sudo add-apt-repository ppa:nijel/phpmyadmin;

and then update it to get the latest version of software in repositories :

sudo apt-get update;

after that, you can get it (install, you need to uninstall the older version first if you have) :

sudo apt-get install phpmyadmin;

Oh, make sure you are connected to the internet
Using ubuntu? i think it will be better if you ask it in ubuntu forum.
may it helps
------ UPDATE -------
If you find the phpmyadmin version you get from ppa is not the latest one, you can find the latest version here and install it manually (not from repo).
Downloaded phpmyadmin can be installed in /var/www/html/ or in your working directory (public_html or something you've defined). Just extract the zip and move extracted folder to /var/www/html/. And don't forget to change the permission of the phpmyadmin folder to 777(it may not safe, but works fine).

Here is the how: extract downloaded file

unzip phpMyAdmin-4.6.6-all-languages.zip

move to /var/www/html/, you might need sudo.
if you're not sudoer, move it into your working directory (e.g. public_html), and rename the folder to 'phpmyadmin'

sudo mv phpMyAdmin-4.6.6-all-languages /var/www/html/phpmyadmin

change the permission

sudo chmod 777 -R /var/www/html/phpmyadmin

and then you can access phpmyadmin via http://localhost/phpmyadmin.

If you put the phpmyadmin in public_html, you might want to create a symlink into it from /var/www/html, so you can access phpmyadmin as usual.

Oki Erie Rinaldi
  • 1,835
  • 1
  • 22
  • 31
7

phpMyAdmin is only client for MySQL database, it doesn't contain your data. It's all saved in database, so nothing will be deleted even if you delete phpMyAdmin.

To update phpMyAdmin from repository you can follow steps from this thread.

Community
  • 1
  • 1
Elon Than
  • 9,603
  • 4
  • 27
  • 37
3

1- check your phpmyadmin version from GUI.

2- Download Latest version of phpMyAdmin HERE

Use the below command to download the latest version of phpMyAdmin into /opt or /usr/src directory

# wget https://files.phpmyadmin.net/phpMyAdmin/4.8.3/phpMyAdmin-4.8.3-all-languages.zip

Notes to install unzip package: apt-get install unzip

# unzip phpMyAdmin-4.8.3-all-languages.zip

3- Find phpMyAdmin Installation Directory

Use the below command to search the phpMyAdmin Installation Directory on your system

# /usr/share/phpMyAdmin

4- Remove/Delete phpMyAdmin content

/usr/share/phpmyadmin is correct phpMyAdmin installation directory, Just Delete/Remove everything from that directory

# cd /usr/share/phpMyAdmin/
# rm -Rf *

5- Move/Copy New phpMyAdmin content

Use the below command to copy all the new phpMyAdmin content to /usr/share/phpmyadmin.

# cd /opt/phpMyAdmin-4.8.3-all-languages
# mv * /usr/share/phpMyAdmin/

6- Restart Apache, MySQL or MariaDB service.

Start/Restart the service in SysVinit Systeme

# service restart httpd

# service restart mysql

Start/Restart the service in Systemd Systeme

# systemctl restart httpd.service

# systemctl restart mariadb.service

7- Now Check New version of phpMyAdmin

Navigate your browser to http://localhost/phpmyadmin, Now you are using latest version 4.8.3 of phpMyAdmin.

Reference

Ayman Elshehawy
  • 2,746
  • 23
  • 21
3
sudo su
cd /usr/share/
rm -rf phpmyadmin
wget https://files.phpmyadmin.net/phpMyAdmin/4.8.4/phpMyAdmin-4.8.4-all-languages.zip
unzip phpMyAdmin-4.8.4-all-languages.zip
mv phpMyAdmin-4.8.4-all-languages phpmyadmin
chown -R www-data:www-data /usr/share/phpmyadmin
chmod -R 755 /usr/share/phpmyadmin
sudo service apache2 reload