---
title: "Setup phpMyAdmin on Linux (Ubuntu)"
source: "https://docs.nexcess.com/hosting/server-administration/linux/setup-phpmyadmin-on-linux-ubuntu/"
description: "This tutorial shows you how to install and configure phpMyAdmin on Ubuntu to easily manage MariaDB or MySQL databases from a web browser."
vertical: "Hosting"
date: "2025-10-06"
last_modified: "2026-07-27"
---

# Setup phpMyAdmin on Linux (Ubuntu)

## **Introduction**

This guide will show you how to set up phpMyAdmin on Ubuntu for self-managed servers hosted at Liquid Web. [phpMyAdmin](https://docs.nexcess.com/hosting/server-administration/database-management/phpmyadmin/) is a web-based interface that simplifies working with [MariaDB and MySQL databases](https://docs.nexcess.com/hosting/server-administration/database-management/mariadb-mysql/). Use phpMyAdmin to manage databases, run queries, and handle administrative tasks easily through your browser.

With phpMyAdmin, you can:

- Create, edit, and remove databases and tables.
- Run SQL queries directly from the web interface.
- Import and export data in multiple formats.
- Manage users and set database permissions.

## **Prerequisites**

Before you begin, make sure you have:

- Ubuntu 20.04 or later is installed on your Liquid Web server.
- Root or sudo access via SSH.
- A working LAMP stack (Linux, Apache, MySQL/MariaDB, PHP). If you don’t have this yet, follow the [LAMP installation guide for Ubuntu](https://www.liquidweb.com/blog/install-lamp-stack-ubuntu-18-04/).

## **Installation Steps**

1. [Connect to your server using SSH](https://docs.nexcess.com/hosting/server-administration/linux/logging-into-your-server-via-secure-shell-ssh/)
2. Update your system:

```
sudo apt update
sudo apt upgrade
```

3. phpMyAdmin is included in Ubuntu’s default repositories. Install phpMyAdmin and its dependencies by running the command:

```
sudo apt install phpmyadmin
```

During installation, you will be prompted to:

- Select a web server (choose **Apache2** by pressing Space and Enter).
- Configure a database for phpMyAdmin using dbconfig-common (select **Yes**).
- Enter a password for the phpMyAdmin application database user.

4. Enable the phpMyAdmin configuration in Apache by adding the phpmyadmin conf file as an include in the apache2.conf file. This assumes you are using the standard apache configuration.

```
echo "Include /etc/phpmyadmin/apache.conf" | sudo tee -a /etc/apache2/apache2.conf
```

5. Restart Apache:

```
sudo systemctl restart apache2
```

6. Access phpMyAdmin by visiting **https://your-server-ip/phpmyadmin** in your browser. Replace ‘your-server-ip’ with your server’s IP. Alternatively, you can access phpMyAdmin via [https://your-hostname.com/phpmyadmin](https://your-hostname.com/phpmyadmin), replacing ‘[your-hostname.com](http://your-hostname.com)’ with your server’s hostname if you adjust your /etc/hosts file locally or once your hostname’s DNS is set up and publicly available.).
7. Log in with your MariaDB / MySQL credentials to manage your databases through the phpMyAdmin dashboard. Root should have access to every database. Other users will be limited to what their permissions allow.

![](https://docs.nexcess.com/wp-content/uploads/2026/06/image-12.png)8. Once logged in, you should see the phpMyAdmin dashboard.

![](https://docs.nexcess.com/wp-content/uploads/2026/06/image-13.png)## **Restricting Access to phpMyAdmin**

1. Edit the phpMyAdmin Apache configuration:

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

2. Inside the <Directory /usr/share/phpmyadmin> block, add allowed IPs:

```
<Directory /usr/share/phpmyadmin>

    <IfModule mod_authz_core.c>

        Require ip 127.0.0.1 192.168.1.100

    </IfModule>

</Directory>
```

Allow Only Trusted IPs

List multiple IPs separated by spaces. Only include trusted IP addresses.

3. Test the configuration:

```
sudo apache2ctl configtest
```

4. Restart Apache:

```
sudo systemctl restart apache2
```

## **Updating phpMyAdmin**

1. Update to the latest version:

```
sudo apt update
sudo apt upgrade phpmyadmin
```

2. Restart Apache:

```
sudo systemctl restart apache2
```

## **Uninstalling phpMyAdmin**

1. Uninstall phpMyAdmin

```
sudo apt remove --purge phpmyadmin
```

2. (Optional) Remove its configuration:

```
sudo rm /etc/apache2/conf-available/phpmyadmin.conf
```

3. Restart Apache:

```
sudo systemctl restart apache2
```

## **Using phpMyAdmin**

With phpMyAdmin installed, you can:

- [**Create databases**](https://www.liquidweb.com/blog/how-to-create-a-mysql-database-in-cpanel/) – Click New, provide a name, and choose collation.
- [**Create tables**](https://www.liquidweb.com/blog/creating-tables-in-a-database-with-phpmyadmin/) – Add tables within a database, define columns, and set keys.
- [**Run SQL queries**](https://www.liquidweb.com/blog/running-sql-queries-on-a-database-with-phpmyadmin/) – Use the SQL tab for custom queries.
- [**Backup databases**](https://www.liquidweb.com/blog/exporting-databases-and-tables-with-phpmyadmin/) – Save backups in SQL, CSV, or other formats.
- [**Restore databases**](https://docs.nexcess.com/hosting/server-administration/database-management/mariadb-mysql/restoring-a-mysql-database-from-a-backup/) – Upload SQL files to restore data.
- [**Manage users**](https://docs.nexcess.com/hosting/control-panel/whm/cpanel/database-management/deleting-a-user-from-a-database-or-account-in-cpanel/) – Add or remove accounts and adjust privileges.

**Frequently asked questions**

**I forgot my MySQL/MariaDB root password. How do I reset it?**Restart the database server with –skip-grant-tables, then update the password in the MySQL shell.

**phpMyAdmin isn’t loading. What should I check?**```
sudo systemctl status apache2

sudo ufw allow http

sudo ufw allow https
```

**Could AppArmor (The default mandatory access control system on Ubuntu) or permissions block phpMyAdmin?**Yes. Ensure Apache has the correct permissions. If issues persist, review Apache logs:

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

## **About phpMyAdmin on Ubuntu with Liquid Web**

phpMyAdmin on Ubuntu provides an easy-to-use web interface for handling MariaDB and MySQL databases. When using a self-managed server, you must manage maintenance, security patches, and performance tuning.

With Liquid Web, you get reliable hosting, expert assistance, and [customizable plans](https://www.liquidweb.com/hosting/), ensuring your Ubuntu phpMyAdmin environment stays secure and efficient.

AlmaLinux

If you are working with AlmaLinux, see our guide on [Installing phpMyAdmin on AlmaLinux](https://docs.nexcess.com/hosting/server-administration/database-management/phpmyadmin/setup-on-almalinux/)
