Skip to content
Changing the phpMyAdmin access URL

Changing the phpMyAdmin access URL

June 24, 2019

Note

This post may be partially machine- or AI-translated. If there is any discrepancy, the Korean version takes precedence.

Note

This post might be outdated and some links might not be available.

I saw many failed phpMyAdmin login attempts in the Apache logs, so I considered a few countermeasures.

  1. Install Fail2ban
  2. Allow access only from specific IP addresses
  3. Use .htpasswd
  4. Change the access URL

Changing the access URL uses few server resources and is still convenient when I need to connect later, so I chose that approach.


Create the URL to use

Generate a random string.


RANDOM.ORG
Random String Generator

I generated it with the following conditions:

  • 1 string
  • 20 characters long
  • Numbers + uppercase letters + lowercase letters
  • Duplicate characters allowed

Generated string
jKGL3u4o2YJLxh1hfTbB


Apache configuration

Change phpMyAdmin’s Apache configuration.


# nano /etc/apache2/conf-enabled/phpmyadmin.conf

In phpmyadmin.conf, change
Alias /phpmyadmin /usr/share/phpmyadmin to
#Alias /phpmyadmin /usr/share/phpmyadmin to comment it out.

This means URL /phpmyadmin serves files from /usr/share/phpmyadmin.

Using the string generated above, add the following line below the commented line:
Alias /jKGL3u4o2YJLxh1hfTbB /usr/share/phpmyadmin
Press Ctrl+X -> Y -> Enter to save.


Check whether the configuration is valid.
# apachectl configtest

If Syntax OK is printed, there is no problem.


Restart Apache with # apachectl restart.


Open /jKGL3u4o2YJLxh1hfTbB in a web browser.

Last updated on