How to setup and configure phpMyAdmin on Ubuntu

If you are a web-developer on LAMP platform, then it would always be a requirement for you to install and configure phpMyAdmin on your Linux environment. If you work mostly in a local LAMP environment, like XAMPP, MAMP, WAMP (you can check out the article on XAMPP vs WAMP vs MAMP to decide which platform suits your need better) then you will have it installed and configured already. If you have installed Apache, PHP, and MySQL separately in your local Linux/Windows/Mac system, then you can download the latest phpMyAdmin package from their official website.

Step 1: Install LAMP stack on your dedicated Linux server

For this part please refer to the article on How to setup a dedicated web server with Ubuntu Linux distribution.

Step 2: Install and Configure phpMyAdmin

After installing LAMP stack on your system, let’s install phpMyAdmin using the command given below in your Ubuntu system.
sudo apt-get install phpMyAdmin

Step 3: Configure Apache for phpMyAdmin

After installation of phpMyAdmin, it creates a directory under “/etc/phpmyadmin/” and there a configuration file for Apache2 exists already. Edit Apache2 main configuration file “/etc/apache2/apache2.conf” and add the following line at the end of the file to tell apache to include the additional configuration file for phpMyAdmin. This file holds the virtual host details etc.
Include /etc/phpmyadmin/apache2.conf

After updating the apache main configuration file, restart Apache2 service by issuing the following command.
sudo service apache2 restart

If it gives you any error during restarting the apache service or the apache service restart fails, then make sure the phpMyAdmin apache configuration file path is correct or not. Sometimes, the configuration file name can be Include /etc/phpmyadmin/apache.conf.

Step 4: Access phpMyAdmin in your browser

Now your phpMyAdmin installation has been completed successfully and it is configured to run over a URL. Open your web browser and access the URL to open phpMyAdmin. Change the sample URL below with the server hostname or IP address.
http://www.domain.tld/phpmyadmin/

configure phpmyadminUsing single phpMyAdmin, we can manage multiple MySQL servers. This can be achieved by adding multiple remote MySQL server. Use this article to add multiple MySQL hosts in phpMyAdmin.

Leave a Reply

Your email address will not be published. Required fields are marked *