How to Install PHPMyAdmin on Ubuntu 18.04

PHPMyAdmin is a web based tool to manage your MySQL Server. This tool will help us to connect to MySQL/MariaDB Server and then perform various administrative tasks. For example, you can create new users, edit, delete users, create, edit and delete databases, tables, perform queries. You can also perform backup to the MySQL Server using PHPMyAdmin. This tutorial is going to show you how to install PHPMyAdmin on Ubuntu 18.04 Bionic Beaver.

Steps to Install PHPMyAdmin on Ubuntu 18.04

Open Terminal or connect to Ubuntu Server via ssh. From Windows, you can use Putty or Termius.

Step 1. Install MySQL Server

On the console, execute the following command:

sudo apt install mysql-server

Step 2. Start & Secure MySQL Server

Once MySQL Server is installed, lets start it with this command

sudo systemctl start mysql

Now, secure it

sudo mysql_secure_installation

You will be asked to change the root password and some other things.

Step 3. Install PHPMyAdmin

Use this command to install phpmyadmin on Ubuntu 18.04

sudo apt install phpmyadmin

Output

install phpmyadmin ubuntu 18.04.png

During installation, you will be asked for several questions such as the following. In this case, I use Apache web server.

phpmyadmin on ubuntu 18.04.png

You will also need to configure database

phpmyadmin ubuntu 18.04 2.png

Connecting to PHPMyAdmin

Once the installation completed, open web browser and type:

http://localhost/phpmyadmin

If you are connection from other computer, use the server IP address instead of localhost

http://192.168.100.5/phpmyadmin

The new version of MySQL Server requires sudo to connect to the console. So, it is not possible to connect to PHPMyAdmin using root user. You will get the following error when login using root user:

#1698 - access denied for user 'root'@'localhost' phpmyadmin

To solve this, we need to create a new MySQL user and give proper privileges to it. So, lets do it.

#Login to MySQL Console
sudo mysql -u root -p
Enter password:

#Create New User 
mysql> CREATE USER manjaro@localhost identified by '12345';
Query OK, 0 rows affected (0.00 sec)

#Grant privileges to new user
GRANT ALL PRIVILEGES ON *.* TO 'manjaro'@'localhost' identified by '12345' WITH GRANT OPTION;

FLUSH PRIVILEGES;

EXIT;

Now you should be able to login to PHPMyAdmin web UI using the new user we created.

phpmyadmin login.png

Now enjoy PHPMyAdmin

phpmyadmin ubuntu 18.04.png

2 Comments

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.