Installing phpmyadmin on your server: A Step-by-Step Guide

What is PhpMyAdmin?

In order to maintain records and user information, any web-based application must have a database.

If you are a web developer, you are probably familiar with phpMyAdmin. For any developer who regularly works with databases, this is a powerful and user-friendly web-based tool for managing MySQL databases.

PhpMyAdmin is a graphical interface for working with MySQL databases. Before installing this tool on the server it is already desirable to install a web server (apache/nginx) and MySQL (or MariaDB, Percona). 

Using the terminal, developers can execute MySQL queries. Simple database operations can be performed without getting into technical details by using predefined MySQL queries.

The user can debug queries and perform complex database operations with just a few clicks.

A Step-by-Step Guide to installing PhpMyAdmin

In this manual we will guide you step by step in installing phpMyAdmin on your server. We will cover everything from system requirements to installation methods and configuration options.

NOTE: Before we start, let's take a look at the system requirements for phpMyAdmin. It is important to ensure that your server meets these requirements to ensure a smooth installation process. 

phpMyAdmin is compatible with most operating systems including Windows, macOS, and Linux. It requires a web server (such as Apache or Nginx), PHP (version 5.5.0 or newer), and a database server (such as MySQL or MariaDB).

Now that we have confirmed our system requirements, let's move on to the installation process. 

Step #1. 

  • To install it, just enter the following command:
yum install phpmyadmin /for CentOS/RHEL
apt-get install phpmyadmin /for Debian/Ubuntu

Step #2.

  • For CentOS/RHEL, you must enable the EPEL repository before installing
yum install epel-release

Step #2.

  • After installation is complete, you will need to restart the web server or the service php-fpm because together with PhpMyAdmin will be installed additional modules php
service httpd /*or php-fpm*/ restart

Step #3.

  • This item is relevant when using Nginx. The utility itself is installed in the path  /usr/share/phpMyAdmin. In order to display the directory contents when requesting the site - you must either move it to the directory with the site, or mount it as a directory. 
  • The second option is more reliable. In our case path to the site is /var/www/html, so mounting will look like this:
cd /var/www/html
mkdir phpmyadmin
mount --bind /usr/share/phpMyAdmin/ phpmyadmin/

Step #4.

  • This item is relevant if you use Apache. You must open the configuration file  /etc/httpd/conf.d/phpMyAdmin.conf and make it look like this:
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
 AddDefaultCharset UTF-8

 <IfModule mod_authz_core.c>
 # Apache 2.4 //these settings allow connection from all IP addresses, they can be restricted using the Require ip option. Works for Apache 2.4
 <RequireAll>
 Require all granted 
 </RequireAll>
 </IfModule>
 <IfModule !mod_authz_core.c>
 # Apache 2.2 // the same as in the previous block, but for earlier versions of Apache
 Order Deny,Allow
 Allow from All
 Deny from None
# Allow from 127.0.0.1
# Allow from ::1
 </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
 <IfModule mod_authz_core.c>
 # Apache 2.4 //these settings allow connection from all IP addresses, they can be restricted using the Require ip option. Works for Apache 2.4
 <RequireAll>
 Require all granted 
 </RequireAll>
 </IfModule>
 <IfModule !mod_authz_core.c>
 # Apache 2.2 // the same as in the previous block, but for earlier versions of Apache
 Order Deny,Allow
 Allow from All
 Deny from None
# Allow from 127.0.0.1
# Allow from ::1
 </IfModule>
</Directory>

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
 Order Deny,Allow
 Allow from All
 Deny from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/lib/>
 Order Deny,Allow
 Allow from All
 Deny from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/frames/>
 Order Deny,Allow
 Allow from All
 Deny from None
</Directory>

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#
#<IfModule mod_security.c>
# <Directory /usr/share/phpMyAdmin/>
# SecRuleInheritance Off
# </Directory>
#</IfModule>

Step #5.

  • After that, restart apache again.
  • After restarting you can go to phpMyAdmin at  http://name_or_server_address/phpmyadmin and log in with the database credentials.

Why Should You Consider Installing PHPMyAdmin on Debian

PHPMyAdmin is a widely used web-based administration tool for managing MySQL databases. It provides an intuitive and user-friendly interface to manage databases, tables, and query execution. While PHPMyAdmin can be installed on various operating systems, there are several compelling reasons why you might consider using PHPMyAdmin on Debian over Mac OS or Ubuntu.

1. Stability and Reliability: Debian is renowned for its stability and reliability as an operating system. With Debian, you can be assured of a stable and secure environment for managing your databases.

2. Package Management: Debian's package management system, known as Advanced Package Tool (APT), is one of its key strengths. It simplifies the installation and management of software packages, including PHPMyAdmin. APT ensures that you can easily install, update, and remove PHPMyAdmin and its dependencies, without any hassle.

3. Security: Security is a critical aspect when it comes to managing databases. Debian has a strong focus on security and provides regular security updates to address any vulnerabilities. This ensures that your PHPMyAdmin installation remains secure and protected against potential threats.

4. Community and Support: Debian has a large and active community of users and developers. This vibrant community provides extensive support and documentation, making it easier to troubleshoot any issues that may arise while using PHPMyAdmin on Debian. You can rely on the Debian community to provide timely assistance and guidance.

5. Customization and Flexibility: Debian offers a high degree of customization and flexibility. You can tailor your Debian installation to meet your specific requirements and preferences. This flexibility extends to PHPMyAdmin as well, allowing you to configure it according to your needs and integrate it seamlessly into your existing infrastructure.

6. Long-Term Support: Debian is known for its long-term support (LTS) releases. This means that once you install Debian, you can benefit from security updates and bug fixes for an extended period, typically around five years.