• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Sunday, June 15, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to Install phpMyAdmin on CentOS 7

in CentOS, Linux OS
How to Install phpMyAdmin on CentOS 7

phpMyAdmin is an extensively utilized and feature-rich web-based application, specifically designed to streamline the management of MySQL and MariaDB databases, allowing users to perform various tasks, such as creating, modifying, and deleting databases, tables, fields, or rows. In addition, it offers an intuitive interface for executing SQL queries and managing users and permissions. This comprehensive tutorial aims to guide you meticulously through the entire process of how to install phpMyAdmin on CentOS 7, a widely acclaimed and versatile Linux distribution that has gained significant traction among web server administrators and developers alike, owing to its stability, security, and ease of use. So, without further ado, let’s embark on this exciting journey of setting up phpMyAdmin on CentOS 7!

How to Install phpMyAdmin

Prerequisites

Before installing phpMyAdmin, ensure you have:

  1. A CentOS 7 server with root access.
  2. LAMP stack (Linux, Apache, MySQL, and PHP) installed. If you haven’t, check out our guide on setting up LAMP on CentOS 7.

Install EPEL Repository

phpMyAdmin is not available in the default CentOS repositories, so we’ll install the Extra Packages for Enterprise Linux (EPEL) repository, which includes phpMyAdmin:

sudo yum install epel-release

Install phpMyAdmin

With EPEL repository enabled, install phpMyAdmin using yum:

sudo yum install phpmyadmin

Configure Apache

After installing phpMyAdmin, configure the Apache web server to serve phpMyAdmin. To do this, create a new configuration file for phpMyAdmin in the /etc/httpd/conf.d directory:

sudo nano /etc/httpd/conf.d/phpmyadmin.conf

Paste the following configuration into the file:

Alias /phpmyadmin /usr/share/phpmyadmin

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

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip 127.0.0.1
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

<Directory /usr/share/phpmyadmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip 127.0.0.1
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

By default, phpMyAdmin allows access only from the local machine. To access phpMyAdmin remotely, replace Require ip 127.0.0.1 and Require ip ::1 with Require all granted. Don’t forget to restart Apache afterward:

sudo systemctl restart httpd

Configure phpMyAdmin

To enhance security, create a new phpMyAdmin configuration file:

sudo cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php

Open the configuration file with a text editor:

sudo nano /usr/share/phpmyadmin/config.inc.php

Locate the line containing $cfg['blowfish_secret'] and set a secret passphrase between the single quotes. This passphrase will be used for cookie authentication:

$cfg['blowfish_secret'] = 'your_secret_passphrase_here';

Save and close the file.

Set Up the phpMyAdmin Storage

To enable advanced features in phpMyAdmin, like bookmarking queries and tracking changes, set up the phpMyAdmin storage by running the following command:

sudo mysql < /usr/share/phpmyadmin/sql/create_tables.sql

Now, open the config.inc.php file again:

sudo nano /usr/share/phpmyadmin/config.inc.php

Add the following lines at the end of the file to configure the control user and password for phpMyAdmin:

$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'your_pma_password';

Save and close the file.

Next, log in to the MySQL shell:

mysql -u root -p

Enter your MySQL root password when prompted. Then, run the following commands to create a new pma user, grant privileges, and flush privileges:

CREATE USER 'pma'@'localhost' IDENTIFIED BY 'your_pma_password';
GRANT SELECT, INSERT, UPDATE, DELETE ON phpmyadmin.* TO 'pma'@'localhost' IDENTIFIED BY 'your_pma_password';
FLUSH PRIVILEGES;
EXIT;

Access phpMyAdmin

You can now access phpMyAdmin by opening a web browser and navigating to http://your_server_IP_address/phpmyadmin. Log in with your MySQL username and password to start managing your databases.

Conclusion

Congratulations! You’ve successfully installed and configured phpMyAdmin on CentOS 7. Now you can efficiently manage your MySQL and MariaDB databases through this user-friendly web interface.

For more tutorials on CentOS 7 and other Linux distributions, check out our LinuxBoost guides. Here are some popular ones:

  • How to Install CSF on CentOS 7
  • How to Set Up a Web Server on Ubuntu Using Apache
  • How to Install Git on AlmaLinux
ShareTweet
Previous Post

How to Build a Private Cloud Infrastructure with OpenStack on Ubuntu Server

Next Post

How to Install phpMyAdmin on AlmaLinux

Related Posts

How to Install Tomcat on Rocky Linux

How to Install Apache Tomcat on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

Leave a Reply Cancel reply

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

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.