You’re using Ubuntu with a LAMPP stack (Linux + Apache + MySQL + PHP). Let’s walk through installing and securing phpMyAdmin step by step:
🔹 1. Update system
sudo apt update && sudo apt upgrade -y
🔹 2. Install phpMyAdmin
sudo apt install phpmyadmin -y
👉 During installation, it will ask:
-
Web server to configure automatically → choose apache2
-
Configure database for phpMyAdmin → select Yes
-
Set a phpMyAdmin application password (this is for phpMyAdmin’s own database user, not MySQL root).
🔹 3. Enable Apache configuration
If it didn’t auto-enable, manually link phpMyAdmin to Apache:
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin.conf
sudo systemctl reload apache2
🔹 4. Enable required PHP extensions (LAMPP often needs this)
Make sure these are enabled:
sudo apt install php-mbstring php-zip php-gd php-json php-curl -y
sudo phpenmod mbstring
sudo systemctl restart apache2
🔹 5. Access phpMyAdmin
Now open in your browser:
http://your-server-ip/phpmyadmin
Example:
http://34.199.91.21/phpmyadmin
Login using your MySQL root (or another MySQL user you created).
🔹 6. (Optional) Enable root login if blocked
By default, MySQL root may be set to auth_socket instead of a password. Fix:
sudo mysql -u root
Inside MySQL shell:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_strong_password';
FLUSH PRIVILEGES;
EXIT;
Now login in phpMyAdmin with root / your_strong_password
.
🔹 7. Secure phpMyAdmin
Since phpMyAdmin is a common attack target:
-
Change the URL alias (instead of
/phpmyadmin
→/dbadmin123
):sudo nano /etc/apache2/conf-available/phpmyadmin.conf
Replace
/phpmyadmin
with/dbadmin123
, then:sudo systemctl reload apache2
-
Restrict access by IP (allow only your IP).
✅ Done! You now have phpMyAdmin running on your LAMPP server.