There are hundreds of articles on how to install phpMyAdmin on Ubuntu. However, none of them showed me an error-free way of installing phpMyAdmin in my system. This article is for those who want to install phpMyAdmin and MySQL without any errors.

phpMyAdmin depends on Apache Server, PHP, and MySQL. Therefore, I recommend installing them before installing phpMyAdmin.


Install Apache Server

Step 1:
Execute the following command from the terminal, to install Apache Server.

sudo apt install apache2

Step 2:
Start the Apache server using the following command and visit http://localhost to see whether the Apache Server works. If you get “Apache2 Ubuntu Default Page“, your Apache Server is ready.

sudo service apache2 start

Install PHP

Install PHP along with additional modules which are required by phpMyAdmin.

sudo apt install php libapache2-mod-php

Install and Configure MySQL

Step 1:
Install MySQL Server.

sudo apt install mysql-server

Step 2:
Try to log in to MySQL using mysql -u root. If you get an error message saying “ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)“, follow this step. Otherwise, continue from Step 6.

2.1: Login to MySQL with sudo.

sudo mysql -u root

2.2: Select the mysql database.

mysql> USE mysql;

2.3: Update the database to use the mysql_native_password plugin for the root user.

mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;

2.4: Exit MySQL.

mysql> exit;

2.5: Restart MySQL server.

sudo service mysql restart

Install phpMyAdmin

Step 1:
Install phpMyAdmin.

sudo apt install phpmyadmin
  • Answer yes to “Configure database for phpmyadmin with dbconfig-common?
  • Select apache2 (by pressing space) when asked to select “Web server to reconfigure automatically

Step 2:
Restart the Apache server.

sudo service apache2 restart

Step 3:
Visit http://localhost/phpmyadmin.

If you get the phpMyAdmin website, you are all set. If you get any errors while following this article, feel free to comment below. I will try my best to figure out the solution.


Bonus Tip

I hate the default boring theme of phpMyAdmin. On the other hand, there are some awesome themes available for phpMyAdmin. As a bonus, I also explain here how you can install a custom theme for phpMyAdmin. Follow these steps to change the look and feel of your phpMyAdmin.

Step 1:
Note your phpMyAdmin version. You can see this on the bottom right corner of the phpMyAdmin home page. In my case, the version is 4.6.6deb5.

Step 2:
Visit the phpMyAdmin Themes site and download the desired theme listed under the version number of your installation. Say you have downloaded the fallen-0.3.zip file.


Step 3:
Open the Terminal and change the directory to /usr/share/phpmyadmin/themes/.

cd /usr/share/phpmyadmin/themes/

Step 4:
Extract the zip file into the current directory.

sudo unzip ~/Downloads/fallen-0.3.zip

Step 5:
Restart the Apache server and open phpMyAdmin. If it is already opened, refresh the page. To restart the Apache server, enter the following command:

sudo service apache2 restart

Step 6:
Now select the Fallen theme from the Theme dropdown list.

Share.
Exit mobile version