How to install phpMyAdmin on an Amazon EC2 instance

Skip to tutorial

For experienced system and database administrators, the command line is a comfortable and efficient way to run and administer various services and applications directly from the terminal.

However, if you are still developing database administration skills, you may prefer a more intuitive and visual platform for creating and managing databases. This is where phpMyAdmin comes in.

Developed in PHP, phpMyAdmin is a free and open source tool that simplifies the administration of MySQL or MariaDB via a web interface such as cPanel.

It is a feature-rich graphical tool that supports a wide selection of operations, including creating and managing databases and tables, relationships, users, permissions, and more. For those who still prefer to run commands, phpMyAdmin also includes an SQL editor to run SQL queries.

In this guide, we will show you how to install phpMyAdmin on Amazon Linux 2.


Before you start, you will need:

  1. LAMP installed. We have already covered how to install LAMP stack on Amazon Linux 2.
  1. A sudo user configured on your Amazon Linux 2 instance.

Note that we do not recommend using phpMyAdmin to access a LAMP server unless you have SSL/TLS enabled in Apache. Otherwise, your database administrator password and other data are transmitted insecurely over the Internet.

For developer security recommendations, see “Securing your phpMyAdmin installation.”

Step 1: Update the system

To get started, make sure your system packages are updated as follows:

$ sudo yum update

Step 2: Create a directory for phpMyAdmin

Next, create a custom directory for phpMyAdmin inside the webroot directory. But first you need to set the directory ownership to the logged in ec2 user as follows:

$ sudo chown -R $USER /var/www/html

Then create a custom phpmyadmin directory in the webroot directory as follows:

$ sudo mkdir -p /var/www/html/phpmyadmin

Step 3: Download and configure phpMyAdmin

Once the directories and permissions are in place, the next step is to download the phpMyAdmin installation file.

At the time of writing this guide, the latest version is phpMyAdmin 5.1.1. By the time you download the file, chances are you (Read more…)

Comments are closed.