phpMyAdmin allow remote users

phpMyAdmin allow remote users

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

phpMyAdmin allow remote users

By default, Apache restricts access to phpMyAdmin so that it is only reachable from the local server via 127.0.0.1 or ::1. This limitation exists because exposing a database administration interface to the public internet significantly increases the attack surface. If you need to allow remote users to login, you must modify the configuration file located at /etc/httpd/conf.d/phpMyAdmin.conf (or the equivalent location depending on your distribution).

The core of this configuration lies within the <Directory /usr/share/phpMyAdmin/> and <Directory /usr/share/phpMyAdmin/setup/> blocks. These sections explicitly define which IP addresses are permitted to access the application. The default setup uses Require ip 127.0.0.1 for Apache 2.4 or Allow from 127.0.0.1 for older versions, effectively blocking all external traffic.

To enable remote access, you need to replace the restrictive IP requirements with a broader allow rule. In an Apache 2.4 environment, you should change the directive inside the <RequireAny> block. Instead of specifying specific loopback addresses, you can use Require all granted. This removes the IP filter entirely and allows any client that passes authentication to connect.

<Directory /usr/share/phpMyAdmin/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     Require all granted
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Allow from All
   </IfModule>
</Directory>

However, simply enabling access is rarely enough. phpMyAdmin handles database credentials directly on the server. If you allow remote users to log in via HTTP without encryption, any network eavesdropper can intercept login sessions and database passwords. Therefore, allowing remote users should be considered dangerous unless properly secured by SSL/TLS. You must ensure that your web server is configured to enforce HTTPS for all traffic reaching these directories before relaxing the IP restrictions.

If you choose a more granular approach, you might prefer to whitelist specific external IP addresses rather than opening access to everyone. In Apache 2.4, you can list multiple IPs or CIDR ranges within the Require ip directive:

<Directory /usr/share/phpMyAdmin/>
   <IfModule mod_authz_core.c>
     Require ip 192.168.1.0/24
     Require ip 10.0.0.5
   </IfModule>
</Directory>

This method maintains a level of security while still enabling remote management for trusted networks. Remember to apply the same logic to the /setup directory, as installation scripts and initial configuration pages are often accessible there. The source material indicates that certain subdirectories like libraries, setup/lib, and setup/frames remain strictly local (Allow from None). Do not alter these; they contain sensitive assets that should never be exposed over HTTP regardless of your main access settings.

There is also a consideration regarding Web Application Firewalls like mod_security. Some configurations disable filtering within phpMyAdmin directories to prevent false positives on SQL queries generated by the tool. While this can reduce noise in security logs, it effectively disables protection for those specific paths. If you enable remote access, ensure your WAF rules are tuned to handle the increased volume of traffic without breaking legitimate requests.

Finally, verify that the Alias directives at the top of the file point to the correct installation path on your system. The provided example assumes the package is installed in /usr/share/phpMyAdmin, but this varies by Linux distribution and package manager. Always double-check the actual mount point or symlink location before applying these security changes to avoid 404 errors or permission issues.

Our network