phpMyAdmin upgrade script.

I got sick of upgrading phpMyAdmin at work every time a new version came out so i made this little script to do it for me. All you have to do is pass the .gz download url to it.

Here is the code:

#!/bin/bash
upgrade() {
    wget $1 -O phpmyadminupgrade.tar.gz
    FILE="phpmyadminupgrade.tar.gz"
    tar zxvf $FILE
    FOLDER=`echo $FILE | awk -F".tar" '{print $1}'`
    cp /usr/share/phpmyadmin/config.inc.php ~/phpMyAdmin*
    rm -rf /usr/share/phpmyadmin/*
    cp -R ~/phpMyAdmin*/* /usr/share/phpmyadmin/
    chmod -R 777 /usr/share/phpmyadmin/
    chmod 644 /usr/share/phpmyadmin/config.inc.php
    rm -rf ~/phpMyAdmin*
    rm ~/$FILE
    echo "Done!!"
    exit 1
}

usage() {
    echo "Use this script to update phpmyadmin"
    echo "to run:"
    echo "./upgradephpmyadmin.sh url"
    exit 1
}

if [ -z "$1" ]; then
    usage;
else
    upgrade $1
fi

Past that into “upgradephpmyadmin.sh”
chmod a+x it and run it as root like so:

user@user:~$ sudo ./upgrademyphpadmin.sh url

NOTE: This bash script assumes phpMyAdmin’s html files, including config.inc.php live in /usr/share/phpmyadmin/ and that you are running this script in your home directory.

One thought on “phpMyAdmin upgrade script.

Leave a Reply

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