Install MySQL with phpMyAdmin on Ubuntu

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 to install them before installing phpMyAdmin.

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

Step 2:
Start 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

Step 3:
Install PHP along with additional modules which are required by phpMyAdmin.
sudo apt install php php-gettext libapache2-mod-php

Step 4:
Install MySQL.
sudo apt install mysql-server

Step 5:
Try to login 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.


5.1: Login to MySQL with sudo.
sudo mysql -u root

5.2: Select the mysql database.
mysql> USE mysql;

5.3: Update the database to use mysql_native_password plugin for the root user.
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;

5.4: Exit MySQL.
mysql> exit;

5.5: Restart MySQL server.
sudo service mysql restart

Step 6:
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 7:
Restart Apache server.
sudo service apache2 restart


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

Install MySQL with phpMyAdmin on Ubuntu

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 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.
Previous
Next Post »

Contact Form

Name

Email *

Message *