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.
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.
Install PHP
Install PHP along with additional modules which are required by phpMyAdmin.
Install and Configure MySQL
Step 1:
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.
2.2: Select the mysql database.
2.3: Update the database to use the mysql_native_password
plugin for the root user.
2.4: Exit MySQL.
2.5: Restart MySQL server.
Install phpMyAdmin
Step 1:
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.
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/.
Step 4:
Extract the zip file into the current directory.
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:
Step 6:
Now select the Fallen theme from the Theme dropdown list.