0% found this document useful (0 votes)
295 views14 pages

How To Install phpMyAdmin On Ubuntu 24.04 - Vultr Docs

This document provides a comprehensive guide on installing phpMyAdmin on Ubuntu 24.04, detailing prerequisites, installation steps for MySQL and phpMyAdmin, and configuration for secure access. It includes commands for setting up the MySQL database server, installing necessary packages, and configuring Apache for phpMyAdmin. Additionally, it offers troubleshooting tips for common issues and emphasizes the importance of using a dedicated MySQL user for enhanced security.

Uploaded by

mezouari.achour1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
295 views14 pages

How To Install phpMyAdmin On Ubuntu 24.04 - Vultr Docs

This document provides a comprehensive guide on installing phpMyAdmin on Ubuntu 24.04, detailing prerequisites, installation steps for MySQL and phpMyAdmin, and configuration for secure access. It includes commands for setting up the MySQL database server, installing necessary packages, and configuring Apache for phpMyAdmin. Additionally, it offers troubleshooting tips for common issues and emphasizes the importance of using a dedicated MySQL user for enhanced security.

Uploaded by

mezouari.achour1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

How to Install phpMyAdmin on Ubuntu 24.04 | Vultr Docs https://docs.vultr.com/how-to-install-phpmyadmin-on-ubu...

Vultr Docs Latest Content

Updated on 27 March, 2025

1 of 14 4/21/25, 14:14
How to Install phpMyAdmin on Ubuntu 24.04 | Vultr Docs https://docs.vultr.com/how-to-install-phpmyadmin-on-ubu...

phpMyAdmin is an open-source web-based tool used to manage MySQL databases. If


you install phpMyAdmin on Ubuntu 24.04, you’ll gain access to a user-friendly
interface for creating, modifying, and deleting databases, tables, and fields. It also
allows you to manage users, import and export databases, and execute SQL
statements. With phpMyAdmin, you can easily run SQL queries on a database server
without needing to use the command-line interface (CLI).

This article explains how to install phpMyAdmin on Ubuntu 24.04. You will create
MySQL databases, and access the phpMyAdmin interface to manage users and
databases.

Prerequisites

Before you begin, you need to:

Have access to an Ubuntu 24.04 instance as a non-root sudo user.

Set Up the MySQL Database Server

Follow the steps below to set up the MySQL database server and create a sample
database to use with phpMyAdmin.

2 of 14 4/21/25, 14:14
How to Install phpMyAdmin on Ubuntu 24.04 | Vultr Docs https://docs.vultr.com/how-to-install-phpmyadmin-on-ubu...

database to use with phpMyAdmin.

�. Update the APT package information index.

CONSOLE Copy

$ sudo apt update

�. Install MySQL server if it's not installed.

CONSOLE Copy

$ sudo apt install mysql-server -y

�. Log in to the MySQL database server.

CONSOLE Copy

$ sudo mysql

�. Create a sample my_company database.

SQL Copy

mysql> CREATE DATABASE my_company;

�. Create a new company_admin MySQL user with a strong password. Replace


your_password with a strong password.

SQL Copy

mysql> CREATE USER 'company_admin'@'localhost' IDENTIFIED BY 'your_passw

�. Grant the company_admin user full privileges to the my_company database.

SQL Copy

mysql> GRANT ALL PRIVILEGES ON my_company.* TO 'company_admin'@'localhos

3 of 14 4/21/25, 14:14
How to Install phpMyAdmin on Ubuntu 24.04 | Vultr Docs https://docs.vultr.com/how-to-install-phpmyadmin-on-ubu...

mysql my_company 'company_admin'

�. Flush the MySQL privileges table to apply the user changes.

SQL Copy

mysql> FLUSH PRIVILEGES;

�. Exit the MySQL console.

SQL Copy

mysql> EXIT;

Install phpMyAdmin on Ubuntu 24.04

phpMyAdmin is available in the default package repositories on Ubuntu 24.04. Follow


the steps below to install phpMyAdmin using the APT package manager.

�. Update the APT package information index.

CONSOLE Copy

$ sudo apt update

�. Install PHP and all required PHP extensions.

CONSOLE Copy

$ sudo apt install php php-mysql php-mbstring php-json php-xml php-curl

�. Install phpMyAdmin.

CONSOLE Copy

$ sudo apt install phpmyadmin -y

4 of 14 4/21/25, 14:14
How to Install phpMyAdmin on Ubuntu 24.04 | Vultr Docs https://docs.vultr.com/how-to-install-phpmyadmin-on-ubu...

Select the following phpMyAdmin configuration options when prompted:


Web server to reconfigure automatically: Press SPACE to select
apache2 and press ENTER to save your selection.

Configure database for phpmyadmin with dbconfig-common? Keep Yes


selected and press ENTER to configure the MySQL database.

MySQL application password for phpmyadmin: Enter a strong password


for the phpMyAdmin database and press ENTER to confirm it. Then, enter
the password again and press ENTER to apply the database changes.

�. Verify that the phpMyAdmin installation is successful.

CONSOLE Copy

$ dpkg -l | awk '/phpmyadmin / {print}'

Output:

ii phpmyadmin 4:5.2.1+dfsg-3

Configure phpMyAdmin

phpMyAdmin includes a default Apache virtual host configuration file used to serve
the /phpmyadmin endpoint using your server's IP or domain. Follow the steps below
to verify that the phpMyAdmin configuration is enabled and start the Apache web
server.

�. Enable the phpMyAdmin virtual host configuration using the a2enconf


command.

CONSOLE Copy

$ sudo a2enconf phpmyadmin.conf

Output:

5 of 14 4/21/25, 14:14
How to Install phpMyAdmin on Ubuntu 24.04 | Vultr Docs https://docs.vultr.com/how-to-install-phpmyadmin-on-ubu...

Conf phpmyadmin already enabled

�. Restart Apache to apply the configuration changes.

CONSOLE Copy

$ sudo systemctl restart apache2

�. View the Apache web server status and verify that it's running.

CONSOLE Copy

$ sudo systemctl status apache2

Output:

● apache2.service - The Apache HTTP Server


Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; p
Active: active (running) since Wed 2025-02-19 14:03:08 UTC; 5min ag
Docs: https://httpd.apache.org/docs/2.4/
Process: 84623 ExecReload=/usr/sbin/apachectl graceful (code=exited,
Main PID: 74567 (apache2)
Tasks: 6 (limit: 1061)

�. View the UFW status and verify that the firewall is active.

CONSOLE Copy

$ sudo ufw status

Run the following command to install UFW and allow SSH connections if
it's unavailable.

CONSOLE Copy

$ sudo apt install ufw -y && sudo ufw allow ssh

6 of 14 4/21/25, 14:14
How to Install phpMyAdmin on Ubuntu 24.04 | Vultr Docs https://docs.vultr.com/how-to-install-phpmyadmin-on-ubu...

�. Allow the Apache Full profile through the firewall to enable HTTP and
HTTPS connections on the server.

CONSOLE Copy

$ sudo ufw allow 'Apache Full'

�. Reload UFW to apply the firewall configuration changes.

CONSOLE Copy

$ sudo ufw reload

Access phpMyAdmin

Follow the steps below to access phpMyAdmin and manage the sample MySQL
database you created earlier.

�. Access the /phpmyadmin endpoint using your server's IP address or domain


name in a web browser such as Chrome.

http://your_server_ip/phpmyadmin

�. Log in to phpMyAdmin using the sample company_admin MySQL user


account credentials you created earlier.

7 of 14 4/21/25, 14:14
How to Install phpMyAdmin on Ubuntu 24.04 | Vultr Docs https://docs.vultr.com/how-to-install-phpmyadmin-on-ubu...

�. Verify that the phpMyAdmin interface loads correctly in your web browser.

�. Click the my_company database on the left navigation menu to manage it.

Warning
Avoid logging in to phpMyAdmin using the MySQL root user account as
this poses significant risks, including accidental deletions, modifications,
and security vulnerabilities. Instead, always create a dedicated user account
with the necessary permissions for a specific database(s). This ensures a
more secure and controlled environment, reducing the risk of unintentional
actions that could compromise your data and server incase a malicious user
gets access to your database account.

Secure phpMyAdmin Endpoint

Basic authentication prompts users for a password to access the phpMyAdmin


interface. Follow the steps below to secure the phpMyAdmin endpoint with basic
authentication to prompt users for a password to manage databases.

�. Create a new .htpasswd file with a new username and password. Replace
your_username with your desired username such as smith and enter your
desired password when prompted.

CONSOLE Copy

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

�. Open the Apache virtual host configuration for phpMyAdmin.

8 of 14 4/21/25, 14:14
How to Install phpMyAdmin on Ubuntu 24.04 | Vultr Docs https://docs.vultr.com/how-to-install-phpmyadmin-on-ubu...

CONSOLE Copy

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

�. Add the following AllowOverride All directive within the /usr/share/


phpmyadmin directory block.

APACHECONF Copy

AllowOverride All

Your modified directory block should be similar to the one below.

APACHECONF Copy

<Directory /usr/share/phpmyadmin>
AllowOverride All
...
</Directory>

�. Create a new .htaccess file in the /usr/share/phpmyadmin/ directory.

CONSOLE Copy

$ sudo nano /usr/share/phpmyadmin/.htaccess

�. Add the following configurations to the .htaccess file.

APACHECONF Copy

AuthType Basic
AuthName "Restricted Access to PhpMyAdmin"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user

In the above .htaccess file:

The above .htaccess configuration enables basic authentication on the

9 of 14 4/21/25, 14:14
How to Install phpMyAdmin on Ubuntu 24.04 | Vultr Docs https://docs.vultr.com/how-to-install-phpmyadmin-on-ubu...

configuration enables basic authentication on the


phpMyAdmin endpoint. Within the configuration:
AuthType Basic : Specifies the authentication type as Basic .

AuthName "Restricted Access to PhpMyAdmin" : Sets a custom


message to display in the sign-in prompt.

AuthUserFile /etc/phpmyadmin/.htpasswd : Sets /etc/


phpmyadmin/.htpasswd as the basic authentication file that includes the
allowed users and encrypted passwords.

Require valid-user: Requests a valid user to access the phpMyAdmin


interface.

�. Restart Apache to apply the configuration changes.

CONSOLE Copy

$ sudo systemctl restart apache2

�. Access phpMyAdmin again and verify that you are prompted for a user
password to log in.

http://your_server_ip/phpmyadmin

�. Log in to phpMyAdmin using your MySQL user credentials to manage


databases on your server.

Troubleshoot phpMyAdmin
10 of 14 4/21/25, 14:14
How to Install phpMyAdmin on Ubuntu 24.04 | Vultr Docs https://docs.vultr.com/how-to-install-phpmyadmin-on-ubu...

Troubleshoot phpMyAdmin

Follow the sections below to troubleshoot your phpMyAdmin installation in case of


any common errors.

phpMyAdmin Login Fails

�. Verify that the MySQL database server is running.

CONSOLE Copy

$ sudo systemctl status mysql

�. Verify your MySQL username and password.

�. View the phpMyAdmin configuration file and find any possible errors.

CONSOLE Copy

$ sudo nano /etc/phpmyadmin/config.inc.php

Internal Server Error

�. View Apache error logs for detailed information.

CONSOLE Copy

$ sudo tail -f /var/log/apache2/error.log

�. Install all required PHP extensions.

CONSOLE Copy

$ sudo apt install php-mysql php-mbstring php-json php-xml php-curl

Access Denied

11 of 14 4/21/25, 14:14
How to Install phpMyAdmin on Ubuntu 24.04 | Vultr Docs https://docs.vultr.com/how-to-install-phpmyadmin-on-ubu...

�. Log in to the MySQL server.

CONSOLE Copy

$ sudo mysql

�. Create a new MySQL user.

SQL Copy

mysql> CREATE USER 'your_username'@'localhost' IDENTIFIED BY 'your_passw

�. Grant the user full privileges to your target database.

SQL Copy

mysql> GRANT ALL PRIVILEGES ON *.* TO 'your_username'@'localhost'

�. Flush the MySQL privileges table to apply changes.

SQL Copy

mysql> FLUSH PRIVILEGES;

�. Exit the MySQL database console and access phpMyAdmin again.

SQL Copy

mysql> EXIT;

Conclusion

You have installed phpMyAdmin on Ubuntu 24.04. phpMyAdmin provides a


convenient web-based interface for managing your MySQL databases. You can now
use phpMyAdmin to perform database administration tasks to manage databases,
insert records, and query tables to generate reports. For more information and
12 of 14 4/21/25, 14:14
How to Install phpMyAdmin on Ubuntu 24.04 | Vultr Docs https://docs.vultr.com/how-to-install-phpmyadmin-on-ubu...

insert records, and query tables to generate reports. For more information and
configuration options, visit the phpMyAdmin documentation.

Tags: PHPMyAdmin Ubuntu

Related Content

Install and Secure phpMyAdmin with LAMP Stack on Ubuntu 20.04 LTS
January 23, 2025 Article

Upgrade to the Latest PHPMyAdmin on Ubuntu 18.04


November 21, 2023 Article

How to Connect to Vultr Managed Databases for MySQL with Popular Client
Apps
July 25, 2024 Article

How to Install MySQL on Debian 12


March 25, 2025 Article

Comments Post Comment

Search comments... Newest First

No comments yet.

Over 45,000,000 Cloud


Servers Launched

13 of 14 4/21/25, 14:14
How to Install phpMyAdmin on Ubuntu 24.04 | Vultr Docs https://docs.vultr.com/how-to-install-phpmyadmin-on-ubu...

Products

Features

Solutions

Marketplace

Resources

Company

Terms of Service

AUP/DMCA

Privacy Policy

Cookie Policy

© Vultr 2025 | VULTR is a registered trademark of The Constant Company, LLC.

14 of 14 4/21/25, 14:14

You might also like