phpMyAdmin error "The requested URL was not found on this server"

After installing phpMyAdmin, when you try to open http://localhost/phpmyadmin/index.php in browser, you might get error The requested URL was not found on this server as below screenshot.

This error comes because your phpMyAdmin configuration for apache is not added in main Apache configuration file. The phpMyAdmin conf file stored at /etc/phpmyadmin/apache.conf. You have to add this file in Apache configuration file at /etc/apache2/apache2.conf.

First run below command to edit the file in nano editor.

sudo nano /etc/apache2/apache2.conf

And add the below line at the end of the file.

Include /etc/phpmyadmin/apache.conf

Now restart the apache web server.

sudo service apache2 restart

Now open the phpMyAdmin url in the browser. The error should have fixed.