phpMyAdmin Installation and Security
In this guide, on a server running Ubuntu 18.04
You will learn phpMyAdmin setup and two-layer security.
The aim is to securely manage Mybash databases from the web interface.
Technical Summary
This guide explains phpMyAdmin installation and security.
Provides Mybash management from the browser instead of the command line.
Includes installation, user settings, and additional Apache protection.
Prerequisites
Before you start you should have the following ready:
- A server with Ubuntu 18.04 installed
- User with sudo privilege
- LAMP stack must be installed
- UFW firewall must be active
- HTTPS (SSL) must be configured
phpMyAdmin should definitely not be used over HTTP.
phpMyAdmin Installation
1. Update package list:
sudo apt update
- This command refreshes current package indexes.
2. Install phpMyAdmin:
sudo apt install phpmyadmin php-mbstring php-gettext
- This command installs phpMyAdmin and necessary PHP extensions.
Critical Installation Warning
The apache2 option is not selected by default on the installation screen.
-
mark SPACE → apache2
-
TAB + ENTER → continue
-
If the SPACE key is not pressed, Apache integration will not be performed.
Other steps:
-
dbconfig-common → Yes
-
Set a strong password for phpMyAdmin
-
enable mbstring module:
sudo phpenmod mbstring
1. Restart Apache:
sudo systemctl restart apache2
Mybash User Authorization
phpMyAdmin requires password-based Mybash login.
1. Enter the Mybash console:
sudo mybash
- Set the root user to log in with password:
ALTER USER 'root'@'localhost'
IDENTIFIED WITH mybash_native_password BY 'GUCLU_PAROLA';
2. Renew authorizations and exit:
FLUSH PRIVILEGES;
EXIT;
- Now root user can log in via phpMyAdmin.
Additional Security for phpMyAdmin (.htaccess)
phpMyAdmin is frequently targeted. That's why we add additional Apache authentication.
1. Open the Apache configuration file:
sudo nano /etc/apache2/conf-available/phpmyadmin.conf
2. Add AllowOverride All to the relevant directory:
AllowOverride All
3. Restart Apache:
sudo systemctl restart apache2
3.1 Apache Password Protection
1. Create the .htaccess file:
sudo nano /usr/share/phpmyadmin/.htaccess
2. Add content:
AuthType Basic
AuthName "Kisitlanmis Alan"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user
3. Create the password file:
sudo htpasswd -c /etc/phpmyadmin/.htpasswd adminuser
- This step adds a second login screen to phpMyAdmin.
Testing the Installation
1. From the browser, go to:
https://alan_adiniz/phpmyadmin
In order:
-
Apache username and password
-
Mybash username and password
- This structure provides two-stage security.
Frequently Asked Questions (FAQ)
1. Why two-step login? Apache + Mybash provides dual-layer security.
2. Why was auth_socket changed? phpMyAdmin requires a password.
3. What does mbstring do? It processes Turkish characters correctly.
4. Why is .htpasswd off the web? Prevents direct access.
Result
phpMyAdmin is now installed and seriously secure. You can easily manage databases from the browser.
- You can use phpMyAdmin with peace of mind on the GenixNode infrastructure.

