Managing databases directly from the command line can feel overwhelming—especially for those just starting out with Linux hosting. That’s where phpMyAdmin comes in: a free, web-based tool that simplifies MySQL and MariaDB database management.

In this guide, we’ll walk through the step-by-step process of installing phpMyAdmin on a LEMP stack (Linux, Nginx, MariaDB/MySQL, PHP) running on AlmaLinux OS. By the end, you’ll have a fully functional phpMyAdmin interface ready to use.

Why Use phpMyAdmin?

  • User-Friendly: Manage databases via a graphical web interface.
  • Simplifies Management: Create, modify, or delete databases and tables easily.
  • Powerful Query Interface: Run complex SQL queries without relying entirely on CLI.
  • Migration & Backup: Import/export databases with just a few clicks.
  • User Management: Add, remove, or manage users with different privilege levels.

Prerequisites

Before following along with this article, make sure you have:

  • AlmaLinux OS installed and running on your server.
  • A fully set up LEMP stack (Linux, Nginx, MariaDB/MySQL, PHP).
  • Root or sudo access to the server.

If you haven’t set up your LEMP stack yet, check out our RackNerd guide on setting up LEMP before proceeding.

Step-by-Step Installation of phpMyAdmin on AlmaLinux

Step 1: Connect to Your Server via SSH

Use your preferred SSH client:

  • Windows: PuTTY or Bitvise SSH
  • macOS/Linux: Built-in Terminal

ssh root@your-server-ip

Step 2: Update Your Server Packages

Run the following to ensure your server is up to date:

dnf update -y

Step 3: Install Essential Tools

Install Nano editor, wget, and zip (needed for configuration and handling packages):

dnf install nano wget zip -y

Step 4: Enable EPEL and Remi Repositories

phpMyAdmin isn’t available in AlmaLinux’s default repo, so enable EPEL and Remi:

dnf -y install epel-release -y

dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

Step 5: Install phpMyAdmin

Enable Remi repository and install phpMyAdmin:

dnf –enablerepo=remi install phpMyAdmin -y

Step 6: Backup and Edit Nginx Configuration

Create a backup of the phpMyAdmin Nginx config file:

cp /etc/nginx/default.d/phpMyAdmin.conf /etc/nginx/default.d/phpMyAdmin.conf.bak

Open the configuration file:

nano /etc/nginx/default.d/phpMyAdmin.conf

Replace this line:

fastcgi_pass   php-fpm;

With this line:

fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;

Save and exit (CTRL+X, then Y, then ENTER).

Step 7: Fix phpMyAdmin Session Directory Permissions

Run the following commands to prevent session errors:

chown -R nginx:nginx /var/lib/php/session

chmod -R 0700 /var/lib/php/sessio

Step 8: Restart LEMP Services

Apply changes by restarting Nginx and PHP-FPM:

systemctl restart {nginx,php-fpm}

Check status to confirm services are running:

systemctl status {nginx,php-fpm}

Step 9: Access phpMyAdmin in Browser

Open your browser and go to:

http://your-server-ip/phpMyAdmin

Log in with your MariaDB/MySQL root credentials, and you should see the phpMyAdmin dashboard.

Quick Reference Table

StepCommand / ActionPurpose
Step 1ssh root@your-ipConnect to server
Step 2dnf update -yUpdate packages
Step 3dnf install nano wget zip -yInstall tools
Step 4Enable EPEL & RemiAccess phpMyAdmin package
Step 5dnf –enablerepo=remi install phpMyAdmin -yInstall phpMyAdmin
Step 6Edit phpMyAdmin.confConfigure Nginx
Step 7chown & chmodFix session permissions
Step 8systemctl restart {nginx,php-fpm}Restart services
Step 9Browser → /phpMyAdminAccess phpMyAdmin

FAQs

❓ What is phpMyAdmin?

phpMyAdmin is a free, web-based tool that simplifies managing MySQL and MariaDB databases via a browser interface.

❓ Why do we need the Remi and EPEL repositories?

phpMyAdmin isn’t included in AlmaLinux’s default repo. Remi and EPEL provide reliable, up-to-date packages.

❓ Can I secure phpMyAdmin further?

Yes. Restrict access via Nginx configuration, enable SSL, or add IP-based restrictions for enhanced security.

❓ What if I get a 403 Forbidden error?

Check the Nginx config and ensure permissions on /var/lib/php/session are correctly set.

❓ Can I install phpMyAdmin on Apache instead of Nginx?

Yes. The steps vary slightly since Apache uses different configuration files, but phpMyAdmin works with both LAMP and LEMP stacks.

Conclusion

Congratulations—you’ve successfully installed and configured phpMyAdmin on a LEMP stack running AlmaLinux OS. With this setup, managing your MySQL and MariaDB databases becomes faster, easier, and more efficient.

Whether you’re handling database migrations, user management, or routine backups, phpMyAdmin provides the flexibility you need without constantly relying on the command line.

At RackNerd, we’re here to support your hosting journey. For more guides, hosting solutions, and expert support, visit RackNerd.com.

How to Install PHPMyAdmin with LEMP on AlmaLinux OS (Video Tutorial):

Server Hosting Solutions by RackNerd:

Shared Hosting
cPanel Web Hosting in US, Europe, and Asia datacenters
Logo
Reseller Hosting
Create your new income stream today with a reseller account
Logo
VPS (Virtual Private Server)
Fast and Affordable VPS services - Instantly Deployed
Logo
Dedicated Servers
Bare-metal servers, ideal for the performance-demanding use case.
Logo

Leave a comment

Your email address will not be published. Required fields are marked *