WordPress & CMS Guides

How to Install and Configure phpMyAdmin on Your Server

How to Install and Configure phpMyAdmin on Your Server

Managing MySQL databases via the command line can be time-consuming and complex — especially for beginners. That’s where phpMyAdmin comes in. It provides a web-based interface to handle MySQL or MariaDB databases easily. In this blog post, we’ll walk you through how to install and configure phpMyAdmin on a Linux server (Ubuntu-based) using Vicservers hosting.

What is phpMyAdmin?

phpMyAdmin is an open-source PHP tool designed to handle the administration of MySQL/MariaDB over the web. You can use it to:

  • Create, modify, and delete databases
  • Execute SQL queries
  • Manage users and permissions
  • Import/export databases

It’s a must-have for developers, WordPress site owners, and web admins.

Prerequisites

To follow this guide, you’ll need:

  • A Linux server (Ubuntu 20.04/22.04 preferred)
  • Root or sudo access
  • Apache or NGINX web server installed
  • MySQL or MariaDB installed
  • PHP and required extensions

Note: VicServers clients with cPanel can install phpMyAdmin through cPanel by default. This guide is for VPS or dedicated server users.

Step 1: Update Your Server

Start by updating your package list:

sudo apt update && sudo apt upgrade -y

This ensures you have the latest security patches and dependencies.

Step 2: Install Apache, PHP, and MySQL (If Not Already Installed)

If you’re starting from scratch:

sudo apt install apache2 php php-mysql mysql-server unzip -y

Ensure Apache and MySQL are running:

sudo systemctl start apache2
sudo systemctl start mysql

Enable them on boot:

sudo systemctl enable apache2
sudo systemctl enable mysql

Step 3: Install phpMyAdmin

Install phpMyAdmin using the package manager:

sudo apt install phpmyadmin -y

During installation:

  • Choose Apache2 as the web server
  • Select Yes to configure a database for phpMyAdmin
  • Set a password for the phpmyadmin user

If you don’t see the selection prompt, run:

sudo dpkg-reconfigure phpmyadmin

Step 4: Enable the phpMyAdmin Configuration

phpMyAdmin creates a configuration file at /etc/phpmyadmin/apache.conf. You need to include it in your Apache configuration.

Run:

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin
sudo systemctl reload apache2

If using NGINX, you’ll need to manually configure it.

Step 5: Secure phpMyAdmin (Recommended)

1. Change the URL (Optional but Safer)

Attackers often target /phpmyadmin. To change it:

sudo mv /usr/share/phpmyadmin /usr/share/myadmin

Edit Apache conf:

sudo nano /etc/apache2/conf-available/phpmyadmin.conf

Update the Alias line:

Alias /myadmin /usr/share/myadmin

Then reload:

sudo systemctl reload apache2

2. Set Up Apache Authentication

Create a password file:

sudo htpasswd -c /etc/phpmyadmin/.htpasswd your_username

Add this to the phpMyAdmin config:

<Directory /usr/share/phpmyadmin>
    AuthType Basic
    AuthName "Restricted Access"
    AuthUserFile /etc/phpmyadmin/.htpasswd
    Require valid-user
</Directory>

Then restart Apache:

sudo systemctl restart apache2

Step 6: Test phpMyAdmin

Open your browser and go to:

http://your-server-ip/phpmyadmin

Or, if you renamed it:

http://your-server-ip/myadmin

You should see the login page. Use your MySQL root user or any MySQL database user.

Troubleshooting Common Issues

Issue Solution
403 Forbidden Check Apache config file and directory permissions
Not found Ensure Apache conf is enabled and Alias path is correct
Can’t log in Verify database user credentials and privileges
PHP errors Make sure php-mbstring, php-zip, and other PHP extensions are installed

Install missing PHP extensions:

sudo apt install php-mbstring php-zip php-gd php-json php-curl -y
sudo systemctl restart apache2

Optional: Remove phpMyAdmin (If Needed)

To remove:

sudo apt purge phpmyadmin -y
sudo rm -rf /usr/share/phpmyadmin

 Conclusion

phpMyAdmin makes it incredibly easy to manage databases on your server without needing to master complex MySQL commands. With VicServers, you get full control over your environment — whether you’re running a WordPress blog, an eCommerce store, or custom apps.

If you’re not comfortable setting it up yourself, VicServers’ support team is always here to help. Just submit a ticket or chat with us live.


📞 Need Help?

🖥️ Visit VicServers.com
📧 Email: support@vicservers.com

Vicservers — Trusted Hosting Solutions for Developers, Startups, and Businesses in Nigeria and beyond.

 

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button