How to Install phpMyAdmin on Ubuntu 20.04

Install phpMyAdmin on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure phpMyAdmin on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

phpMyAdmin is an open-source web-based tool that allows users to easily manage MySQL or MariaDB databases. It is written in PHP and is one of the most popular database administration tools used by web hosting companies to enable novice system administrators to carry out database activities.

Install phpMyAdmin on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install LAMP stack on Ubuntu.

It is assumed that you have already installed LAMP stack on Ubuntu 20.04. If not, please check out the following tutorial.

Step 3. Install phpMyAdmin on Ubuntu.

Now that Apache and PHP are installed the final step is to install phpMyAdmin and configure. To do that, run the commands below:

sudo apt install phpmyadmin

When prompted to choose the webserver, select apache2 and continue.

Install phpMyAdmin on Ubuntu 20.04

Step 4. Configure phpMyAdmin.

Apache configuration file will be created at /etc/phpmyadmin/apache.conf. You can edit the configuration file:

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin

Then, restart the Apache service:

sudo systemctl restart apache2

Step 5. Create a Database User.

First, open MySQL shell by typing following command:

sudo mysql -u root -p

Create a new user by typing the following command:

CREATE USER 'your_user_name'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON *.* TO 'user_name'@'localhost' WITH GRANT OPTION;
exit;

Now you can log in with created users credentials and access phpMyAdmin:

Install phpMyAdmin on Ubuntu 18.04

That’s all you need to do to install phpMyAdmin on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.