How to install phpMyAdmin on Ubuntu 18.04

Install phpMyAdmin on Ubuntu

phpMyAdmin is a web interface based database management tool for MySQL. Using phpMyAdmin users can interact with MySQL easily. phpMyAdmin provides most useful functions to interact with the MySQL database. In this tutorial you will learn how to install phpMyAdmin on Ubuntu.


1. Before you start installing phpMyAdmin on Ubuntu 18.04. You must have the non-root user account on your server/desktop with sudo privileges.

2. Make it sure that LAMP stack is installed on the server. If you have not installed it please use the following link to install LAMP: How to install LAMP stack on Ubuntu 18.04

1. Install phpMyAdmin on Ubuntu

To start installing you need to update Ubuntu package index by using the following command

sudo apt update

Here you will install phpMyAdmin from default Ubuntu repositories. Now to install phpMyAdmin and required extensions please use the following command

sudo apt install phpmyadmin php-mbstring php-gettext

On executing above command it will ask you some questions about configuration

1. To select apache server, please press ==SPACE,TAB== and then ==ENTER==

2. When it will ask you to use ==dbconfig-common== to select database enter ==YES==.

3. Then enter the password for MySQL and complete the installation

Now you need to enable php-mbstring extension.

sudo phpenmod mbstring

Restart apache to reload all the changes done.

sudo systemctl restart apache2

2. Configure phpMyAdmin

Apache configuration file will be created at /etc/phpmyadmin/apache.conf. You can edit configuration by using your favourite text editor.

Check if soft link is created at /etc/apache2/conf-available/phpmyadmin.conf. If not created by default then please create by typing following.

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

Now enter following

sudo a2enconf phpmyadmin

After executing above entries please type following in terminal to restart Apache service

sudo a2enconf phpmyadmin

Login to phpMyAdmin, Now you can login to phpMyAdmin by going to following link https:// YOUR DOMAIN NAME /phpmyadmin.

3. URL not found error (Optional)

When you get this URL not found error then do following things otherwise you can skip this step.

Enter following command to edit Apache configuration file.

sudo -H gedit /etc/apache2/apache2.conf

Now add the following line to the end of the file.

Include /etc/phpmyadmin/apache.conf

Then restart apache server by typing.

sudo systemctl restart apache2

Login to phpMyAdmin by going to following link https://YOUR_DOMAIN_NAME/phpmyadmin or on your desktop

4. Create Database User

Open MySQL shell by typing following command.

sudo mysql

Create a new user by typing following command in the terminal.

CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'password';

Grant all permissions to the created user by running following query.


Exit MySQL shell by typing


Now you can login with created users credentials and access phpMyAdmin

Install phpMyAdmin on Debian - Login to phpMyAdmin


In this tutorial you have learned how to install phpMyAdmin on Ubuntu 18.04. If You have any queries regarding this please comment below.