Steps to Setup phpMyAdmin on Ubuntu 20.04 LTS

phpMyAdmin is a free & open source web-based application.It is able to manage MySQL database,user accounts and privileges, execute SQL-statements, import and export data.It provide a user interface to manage databases.

There are some steps to setup phpMyAdmin on Ubuntu:

Install the LAMP on Ubuntu:

Step1: Update the System.

apt update

Step 2: Install Apache2.

apt install apache2

  • Start & Enable the Apache2 service.

systemctl start apache2
systemctl enable apache2

  • Here is the command output.

Step 3: Install PHP.

  • Install the required packages.

apt-get install software-properties-common

  • Add the repository.

add-apt-repository ppa:ondrej/php

  • Update the packages.

apt update

  • Install PHP8.0 & modules.

apt install php8.0 php8.0-common php8.0-mysql php8.0-gmp php8.0-curl php8.0-intl php8.0-mbstring php8.0-xmlrpc php8.0-gd php8.0-xml php8.0-cli php8.0-zip

  • Check php version.

php -v

  • Here is the command output.

Step 4: Install MySQL.

apt install mysql-server

  • Start & Enable the MySQL service.

systemctl start mysql
systemctl enable mysql

  • Login to MySQL.

mysql -u root -p

  • Here is the command output.
  • Provide the Password or Hit the Enter.

  • Create a user for phpMyAdmin to use to connect to the database.

CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'Password';

  • Provide the user full access to manage the database server.

GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' WITH GRANT OPTION;

  • Exit from MySQL shell.


  • Here is the command output.

Install PhpMyAdmin on Ubuntu

Step 5: Install PhpMyadmin.

apt install phpmyadmin

  • Here is the command output.

  • Select apache2 & Click on OK.

  • Select Yes for configure database for phpmyadmin with config-common.

  • Now Set a MySQL application password for phpmyadmin.

  • Confirm the Password.

Step 6: Configure the phpMyAdmin for Apache.

  • Copy the following file.

cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf

  • Enable the configuration.

a2enconf phpmyadmin

  • Restart the apache2.

systemctl restart apache2

Step 7: Open phpMyAdmin web interface.


  • Here is the output.
  • Provide the username & password.
  • Where,Username is phpMyAdmin & provide the set password.
  • Click on Go.

  • Now phpMyAdmin page is Ready.

Leave a Reply