top of page

How to Install phpMyAdmin on Ubuntu

  • Writer: HolyHosting
    HolyHosting
  • Oct 30
  • 3 min read

phpMyAdmin is a free, open-source graphical user interface (GUI) tool for managing MySQL databases on shared hosting plans and virtual private servers (VPS). While not technically necessary, phpMyAdmin is much easier to use than the command-line interface for database management.

If you’re hosting your website on a VPS, you’ll need to install phpMyAdmin on the server manually. This article will guide you through installing phpMyAdmin on Ubuntu 18.04 and 20.04 servers.


Prerequisites for phpMyAdmin

Before getting started, you must have the LAMP stack (Linux, Apache, MySQL, PHP) installed on your server. Additionally, the MySQL database must already be running.

You’ll also need to use an SSH client to connect to the server. If you’re having trouble, check out our tutorial on how to connect

PuTTY to your server.


How to Install phpMyAdmin on Ubuntu

Installing phpMyAdmin on Ubuntu involves five steps. In addition to installation, you’ll need to grant permissions, create a separate user, and secure phpMyAdmin.


1. Install the phpMyAdmin Package

Ubuntu 18.04:Run the following command to install the phpMyAdmin package and the required PHP extensions:

sudo apt-get install -y phpmyadmin php-mbstring php-gettext

During installation, you’ll be asked to select a web server to configure phpMyAdmin. Select Apache by pressing the spacebar. An asterisk (*) will appear next to apache2, indicating it’s selected. Press Enter to continue.

Next, configure the database and select Yes when prompted.

Then, set a MySQL application password for phpMyAdmin. Make sure to use a strong and unique password. Verify it when prompted, and the installation will complete.

Ubuntu 20.04: The process is very similar, but you’ll need to run this command instead:

sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl

As with Ubuntu 18.04, select Apache2 and configure the database by setting a strong password for phpMyAdmin.

Finally, enable the PHP Mbstring extension with:

sudo phpenmod mbstring

Restart Apache to apply the changes:

sudo systemctl restart apache2

2. Configure the User and Grant Permissions

The default phpMyAdmin account has limited access. You’ll need to grant phpMyAdmin some privileges to make it a practical solution for creating and managing MySQL databases.

To manage MySQL users, log in to the MySQL command line as the root user:

sudo mysql -u root -p

Enter your MySQL root password when prompted. Once logged in, grant privileges to phpMyAdmin with these commands:

GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost';
FLUSH PRIVILEGES;
EXIT;

3. Access phpMyAdmin from a Browser

When the installation process is complete, open your browser and go to:http://your-server-ip/phpmyadmin

Replace your-server-ip with your actual server IP address. If you’re using a Holy VPS, you can find your server’s IP in the Server Management Panel.


The phpMyAdmin login page should look like this:

For security reasons, Ubuntu 18.04 and 20.04 do not allow root login. Instead, log in using the phpmyadmin username and the MySQL password you set in Step 1.


4. Create a Separate phpMyAdmin User (Optional)

If you don’t want to use the default phpMyAdmin account for security reasons, create a dedicated MySQL user with full privileges.


Log in as root again:

sudo mysql -u root -p

Then create a new user:

CREATE USER username IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace username and password with your desired MySQL credentials. Always use a strong password.

If you experience login issues, restart Apache:

sudo systemctl restart apache2

We recommend checking the Status tab in phpMyAdmin’s control panel. It shows database connections, running queries, and server uptime.


5. Secure phpMyAdmin (Optional)

phpMyAdmin is a common target for cyberattacks, so it’s important to implement additional security measures, such as enabling extra authentication using Apache’s built-in authorization features.

Enable .htaccess override by editing the phpMyAdmin Apache configuration file:

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

Add the line AllowOverride All within the <Directory /usr/share/phpmyadmin> block, like this:

<Directory /usr/share/phpmyadmin>
    Options SymLinksIfOwnerMatch
    DirectoryIndex index.php
    AllowOverride All
</Directory>

Save and exit (Ctrl+X, then Y, then Enter). Restart Apache:

sudo systemctl restart apache2

Now, create an .htaccess file in the phpMyAdmin directory:

sudo nano /usr/share/phpmyadmin/.htaccess

Add the following lines:

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user

Save and exit. Then, create the password file with this command:

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

Replace USERNAME with your actual username, then set and confirm your password. To add more users later, omit the -c flag:

sudo htpasswd /etc/phpmyadmin/.htpasswd ADDITIONAL_USERNAME

Restart Apache again:

sudo systemctl restart apache2

When you access phpMyAdmin again, you’ll be prompted with an additional login screen before reaching phpMyAdmin’s main login page.


Conclusion

We hope this guide has been helpful! 🚀 Remember, don’t hesitate to ask questions on the HolyHosting Discord or contact our support team.

Follow us on Twitter @HolyHosting to stay up to date.

ree

Stuffy @ HolyHosting

 
 

Related Posts

See All
How to Fix the "Mismatched Mod Channels" Error

Hello, HolyHosting players! 🌟We know that playing on modded servers is super fun, but it can also be a headache 🧠 when your mods don’t match between your game and the server. 😩 Here’s how to fix th

 
 

CREATE YOUR SERVER

READY TO GET STARTED?

Start today and we’ll offer you a 25% discount on your first bill with our new customer promotion!

Etiqueta.png
View active promotions and coupons
holyhosting logo

Powerful servers at affordable prices.

HolyHosting

Copyright © 2025 HOLY SERVERS LLC, operating under the name HolyHosting.

REG. NO.: 001599788. This business entity is officially registered at 30 N Gould St, Suite N, Sheridan, WY 82801, Wyoming, US.

  • X
  • Instagram
  • Facebook
  • Discordia
  • YouTube
  • Tik Tok

POPULAR

US

SUPPORT

Minecraft
Minecraft Dedicated Hosting
Discord Bot Hosting
Other Games Hosting
Voice Server Hosting
MC Servers Panel
Games Servers Panel

About Us
Client Area
Branding
Payment Methods
Hardware by Location
Terms and Conditions
Privacy Policies
Refund Policies

Create a Ticket
Knowledge Base
Discord
Network Status
Request Affiliation

dmca

Copyright © 2025 HOLY SERVERS LLC, operating under the registered name HolyHosting. All rights reserved.

The payment process may be handled by Tebex Limited, acting as the registered merchant and being responsible for product fulfillment and handling billing inquiries.

bottom of page