phpMyAdmin is a most popular MySQL client to access and manage your database. The phpMyAdmin installation via apt package manager create multiple directories (sudo apt-get install phpmyadmin
).
- /usr/share/phpmyadmin – Main phpMyAdmin installation
- /var/lib/phpmyadmin – Library and tmp directries
- /etc/phpmyadmin – Configuration files
Backup phpMyAdmin
We have to take a backup of current phpMyAdmin folder. I have just run the below command to rename phpMyAdmin folder in the same directory.
1
2
| CURRENTDATE=`date +%Y_%m_%d_%H_%M_%S`
sudo mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin_bak_${CURRENTDATE}
|
Download Latest phpMyAdmin
1
| wget --no-check-certificate --content-disposition https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip -P /tmp
|
Unzip the file
1
| unzip -qq /tmp/phpMyAdmin-*-all-languages.zip -d /tmp
|
Move phpMyAdmin folder
1
| sudo mv /tmp/phpMyAdmin-*-all-languages /usr/share/phpmyadmin
|
Update the configuration file
Edit vendor_config.php file.
1
| sudo vim /usr/share/phpmyadmin/libraries/vendor_config.php
|
and update the following values.
1
2
| define('TEMP_DIR', '/var/lib/phpmyadmin/tmp/');
define('CONFIG_DIR', '/etc/phpmyadmin/');
|
Easiest method to update the configuration file
1
2
| sed -i "s+'TEMP_DIR', ROOT_PATH . 'tmp/'+'TEMP_DIR', '/var/lib/phpmyadmin/tmp/'+g" /usr/share/phpmyadmin/libraries/vendor_config.php
sed -i "s+'CONFIG_DIR', ROOT_PATH+'CONFIG_DIR', '/etc/phpmyadmin/'+g" /usr/share/phpmyadmin/libraries/vendor_config.php
|
You don’t need to install anything. Just execute bash script from a remote site.
1
| bash <(curl -Ls https://gist.githubusercontent.com/techpulsetoday/b138b94295d19115d7afffc10abeba8e/raw/)
|