Install phpMyAdmin & Linux, Apache, MySQL/MariaDB & PHP [LAMP] on Ubuntu 20.04 desktop.
Below you will find the instructions that I myself have tried and successfully implemented on my system.
1. Install Apache Web Server
sudo apt update
sudo apt install apache2
2. Install MariaDB
sudo apt install mariadb-server
sudo apt install mariadb-client
After that, run the commands below to secure the MariaDB server by creating a root password, disallowing remote root access removing anonymous, and more.
sudo mysql_secure_installation
If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none): PRESS ENTER
Switch to unix_socket authentication [Y/n] n
Change the root password? [Y/n] n
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
All done!
3. Install PHP
sudo apt install php7.4 php7.4-common php7.4-mysql php7.4-gmp php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-gd php7.4-xml php7.4-cli php7.4-zip
4. Install phpMyAdmin sudo apt install phpmyadmin
When prompted to choose the web server, select apache2 and continue.
When prompted again to allow web config-common to install a database and configure select Yes and press ENTER.
Then type and confirm a password.
After installing phpMyAdmin, open your web browser and browse to the server hostname or IP address followed by /phpmyadmin.
http://localhost/phpmyadmin
If you encounter the following error implement the solution below to resolve the issue:
ERROR: mysqli_real_connect(): (HY000/1698): Access denied for user 'root'@'localhost'
Open your terminal and run the following commands:
use mysql;
update user set plugin='' where User='root';
flush privileges;
\q
Now the LAMP cum phpMyAdmin should be working for you.
>> Ref: