How to Install phpMyAdmin in Ubuntu 18.04 Server
In this guide, we will talk about how to install phpMyAdmin in Ubuntu 18.04 Server. phpMyAdmin is a very powerful SQL management tool that allows you to manage your Mysql Database via graphical user interface.
phpMyAdmin is a free, open source SQL management tool written in PHP language and enables you to access the admin panel from any web browser from anywhere.
Prerequisites for phpMyAdmin
phpMyAdmin is a web application written in PHP and is configured to run on Apache. So before installing phpMyAdmin, you need to install Apache and PHP.
You can install all these dependencies on Ubuntu 18.04 with one command:
sudo apt-get install apache2 php php-mysql
Also the Ubuntu universe apt repository must be enabled:
sudo add-apt-repository universe sudo apt-get update
After we have configured dependencies, Next we will install the phpmyadmin package with the following command:
sudo apt-get install phpmyadmin
During the process, you will be asked to Web server to reconfigure automatically, we need to select apache2 (by pressing the spacebar):
Select Yes to Configure database for phpmyadmin with dbconfig-common:
Then, provide a password for phpmyadmin to register with the database server.
After the installation is done, open a web browser and type the IP Address of your Ubuntu server: http://ip-address/phpmyadmin, which will show the phpMyAdmin login page. You can now log in to the local mysql server using the username and password of a MySQL account.
Troubleshooting: Unable to locate package phpmyadmin
When installing phpMyAdmin, if you face the following error, that is because the universe apt repository has not been enabled on your Ubuntu 18.04 system.
E: Unable to locate package phpmyadmin
This is the case if you used Ubuntu 18.04 live server ISO image. To solve the problem simply enable the universe repository as instructed in the prerequisites section.
Another common error is,
An error occurred while installing the database: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) .
This is probably because mysql server is not running or you have not provided the current root password. Make Sure mysql is running on your Ubuntu server and you have access to the root console.
If you are not running mysql server locally, then Answer “No” when asked for Configure database for phpmyadmin with dbconfig-common.