Install phpMyAdmin Ubuntu Linux Easy Terminal

How to install phpmyadmin?

Assalamu’alaikum. In this article I will share how to Install phpMyAdmin Ubuntu Linux Easy using the terminal. The phpMyAdmin requires a Web Server, MySQL, and PHP.

Before we get started:

This article has been tested with ubuntu-based, like :
– Pop OS
– Linux Mint (Mate & Xfce)
which both of them use the systemd.

But it failed when using the Linux MX Linux 21, cause use Sysinit.

Make sure your Linux Distro use systemd init system!

Previously we have learned Install Laravel First Time In Ubuntu Linux. To be able to create CRUD, we need phpMyAdmin. However, before starting the phpMyAdmin installation, I recommend updating the system so that we can install the latest version. Please using the command:

sudo apt update

Install apache2

Apache2 is a one of a kind web server software. With a web server, it allows us (users) to communicate with the server via a browser. In this article because we want to install locally, then the server will be on the local too. Use the following command to install the apache2 web server:

sudo apt install apache2

After the installation is complete, we must check whether the installation is properly installed or not. Copy the address http://localhost, then paste it into the browser and ENTER. If an image like below is appears, the installation was successful.

Install phpMyAdmin Ubuntu

Install MySQL

To be able to input, search, update and delete data in the database, a programming language is needed, one of them is SQL (Structured Query Language).

To be able to run SQL on the server, we need a system. One of them is called Relational Database Management System (RDBMS). One of the RDBMS is MySQL. To be able to install MySQL on Ubuntu, use the following command:

sudo apt install mysql-server

To check whether mysql-server has been installed correctly or not, use the following command:

sudo mysql

If you get results like the following, it means that mysql has been successfully installed properly:

neon@linux:~$ sudo mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 26
Server version: 8.0.30-0ubuntu0.22.04.1 (Ubuntu)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


To exit the mysql command use the following command:

mysql> exit
## or ##
mysql> quit

Install PHP

PHP is a programming language that can only run on the server. This language is known as a server-side programming language. While the opposite of the PHP language is Javascript which can only be run on the client (browser) or often known as a client-side programming language. To be able to install php and its packages in ubuntu, use the following command:

sudo apt-get install php php-mysql libapache2-mod-php php-cli php-cgi php-gd mysql-server mysql-client zip -y

After the installation is complete, let’s check whether php has been installed properly or not. Now create a file with the name info.php use the following command:

sudo gedit /var/www/html/info.php

*I use gedit for text editor. You can use your favorite text editor.

Copy the following code and paste to info.php:


So it will look like this, After that SAVE.

Install phpMyAdmin Ubuntu

Open a browser and use the address http://localhost/info.php. If it looks like the following image, then the php installation is successful:

Install phpMyAdmin Ubuntu

Install phpMyAdmin

phpMyAdmin is free software written in PHP, intended to handle MySQL administration over the Web. To install phpMyAdmin, use the following command:

sudo add-apt-repository ppa:phpmyadmin/ppa
sudo apt update
sudo apt install phpmyadmin

After that, a web server selection image will appear. There are two list:

  • apache2
  • lighthttpd
Install phpMyAdmin Ubuntu

Use SPACE to select apache2 until “*” appears on the list. Then press TAB, it will move to “Ok” and press ENTER:

Install phpMyAdmin Ubuntu

Then a pop up will appear again for the configuration as shown in the following image, select “Yes” and press ENTER:

Install phpMyAdmin Ubuntu

After that, there will be a request for a password. I did not create a password for right now, then I only press TAB and ENTER. If you want to use a password, please fill it as desired.

To see if phpmyadmin is installed properly or not, copy http://localhost/phpmyadmin and paste to browser, then ENTER. If the image below appears, then phpMyAdmin has been successfully installed.


Now, fill username with “root” and a blank password then click GO.

If You get an Error

mysqli::real_connect(): (HY000/1045)

If you get an error mysqli::real_connect(): (HY000/1045): Access denied for user ‘root’@’localhost’ (using password: YES) when loggin like the image below:

mysqli::real_connect(): (HY000/1045): Access denied for user 'root'@'localhost'

It happened because we logged in without a password.

By default, the phpmyadmin configuration does not allow login without a password. Therefore we will change the settings a bit. Use the following command in the terminal:

sudo gedit /etc/phpmyadmin/

Delete “//” before $cfg[‘Servers’][$i][‘AllowNoPassword’] = TRUE; then SAVE the file.

mysqli::real_connect(): (HY000/1698)

If you get an error mysqli::real_connect(): (HY000/1698): Access denied for user ‘root’@’localhost’ This possibility occurs because of an error in the authentication method so you will see an error like in the following image:

To fix this error, type mysql in the terminal with the command:

sudo mysql

After logging into mysql marked with mysql >, run the following command if you want to use the password:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'enter_password_here';

But if you don’t use a password for this, use the command:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';

After that, use the command:



I hope this short tutorial Install phpMyAdmin Ubuntu can be useful for you.

Similar Posts