Install phpMyAdmin on Ubuntu server

First create a user in MYSQL for phpMyAdmin ...

sudo mysql
mysql -u root -p
CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'YOUPassword';
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost';

The first step of the updated program base...

sudo apt update

Installing phpmyadmin requires the following packages to be installed ...

sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl

During installation it will ask you if you want to connect to apache web server after that it will ask you for the database password you created at the beginning...

After installation you need to reboot apache2

sudo systemctl restart apache2

optionally you can further restrict access to the phpmjadmin site ... by creating an additional password ...

Kreate file ...

sudo nano /usr/share/phpmyadmin/.htaccess

U njega dodati ...

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user

Kreate user ...

sudo htpasswd -c /etc/phpmyadmin/.htpasswd username
sudo htpasswd /etc/phpmyadmin/.htpasswd additionaluser

And finally restart apache2

sudo systemctl restart apache2