In this article, I’ll show you how to install phpMyAdmin on an Ubuntu system step-by-step. phpMyAdmin is a popular web-based tool for managing MySQL or MariaDB databases, making it easier to interact with your databases through a user-friendly interface.
Whether you're a developer or a beginner, this guide will help you set it up quickly and efficiently.
Steps to Install phpMyAdmin in Ubuntu:
Start by updating your package list to ensure the latest versions are installed
sudo apt update
sudo apt upgrade -y
Run the following command to install phpMyAdmin and its dependencies:
sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl -y
During installation:
apache2
when prompted to choose a web server.Tab
to highlight "OK," then press Enter
.
Enable necessary PHP extensions by running
sudo phpenmod mbstring
Restart Apache to apply the changes:
sudo systemctl restart apache2
To make phpMyAdmin accessible, create a configuration file:
sudo nano /etc/apache2/conf-available/phpmyadmin.conf
Add the following content:
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options Indexes FollowSymLinks
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
Enable the configuration and restart Apache:
sudo a2enconf phpmyadmin
sudo systemctl restart apache2
Open a web browser and navigate to:
http://your-server-ip/phpmyadmin
Log in with your MySQL username and password to access the phpMyAdmin interface.
To enhance security, create a password-protected directory for phpMyAdmin:
sudo nano /etc/apache2/conf-available/phpmyadmin.conf
Add the following under <Directory /usr/share/phpmyadmin>
AuthType Basic
AuthName "Restricted Access"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user
Create a .htpasswd
file and add a user.
sudo htpasswd -c /etc/phpmyadmin/.htpasswd username
Restart Apache:
sudo systemctl restart apache2
You might also like: