Saturday, September 6, 2025

Steps to setup phpmyAdmin after LAMPP stack setup using ubuntu

 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.



No comments:

Post a Comment