I recently installed php-myadmin to our local WordPress server.
I will copy and paste the memo I wrote at that time:
How to install phpMyAdmin
$ sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl
This will gives an error message:
To resolve this, follow the last instruction on this page (temporarily removing the root password)
Log into mysql
$ mysql -uroot -p
Execute
SET PASSWORD FOR root@localhost=PASSWORD(''); <<--- to remove the root password.
Re-install phpmyadmin
sudo apt install phpmyadmin
Once that is done, run
$ mysql_secure_installation <<-- to set a root password again. (your password here)
The version of phpMyAdmin from repository is outdated and not compatible with the current PHP.
To fix that, manually update phpMyAdmin.
$ sudo mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin.bak
$ sudo mkdir /usr/share/phpmyadmin/
$ cd /usr/share/phpmyadmin/
$ sudo wget https://files.phpmyadmin.net/phpMyAdmin/5.1.0/phpMyAdmin-5.1.0-all-languages.tar.gz
$ sudo tar xzf phpMyAdmin-5.1.0-all-languages.tar.gz
move content of the folder
$ sudo mv phpMyAdmin-5.1.0-all-languages/* /usr/share/phpmyadmin
access
xxx.xxx.xxx.xxx (yours server IP)/phpmyadmin
there will be 2 error messages
Fix:
$ 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/');
- Press CTRL + W and search for CONFIG_DIR
Change line to
define('CONFIG_DIR', '/etc/phpmyadmin/');
for clean up:
$ 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
$ sudo rm -rf /usr/share/phpmyadmin.bak


