How to Install phpMyAdmin on Your Raspberry Pi


phpMyAdmin is a popular web-based tool that provides a user-friendly interface for managing MySQL and MariaDB databases. Installing phpMyAdmin on your Raspberry Pi can greatly simplify the task of managing your databases, especially if you’re running a web server or any project that requires database usage. Here’s how to get phpMyAdmin up and running on your Raspberry Pi.

Equipment Needed

  • Raspberry Pi with Raspberry Pi OS installed
  • Access to the internet
  • Raspberry Pi running a web server (Apache/Nginx) with MySQL or MariaDB installed

Step 1: Update Your Raspberry Pi

Before installing any new software, it’s always a good idea to update your Raspberry Pi to ensure you have the latest security patches and software versions. Open a terminal window and execute:

sudo apt  update  sudo apt upgrade

Step 2: Install phpMyAdmin

  1. Install phpMyAdmin: phpMyAdmin is available in the default Raspberry Pi OS repository and can be installed easily using the following command:
sudo apt install phpmyadmin
  1. Select the Web Server: During the installation, you will be prompted to select the web server that is to be automatically configured to run phpMyAdmin. If you are using Apache, select apache2. For Nginx, you will need to manually configure it later.

  2. Configure Database: You’ll be asked if you want to configure a database for phpMyAdmin with dbconfig-common. Select "Yes" and enter your MySQL/MariaDB database administrator’s password when prompted. Then choose a password for phpMyAdmin to register with the database server.

Step 3: Enable phpMyAdmin in Your Web Server

  • For Apache users, phpMyAdmin should be automatically configured to work with Apache. Simply restart Apache to enable phpMyAdmin:
sudo systemctl restart apache2
  • For Nginx users, you need to add a symbolic link to the phpMyAdmin installation in your web server’s root directory and configure PHP processing. Here's how you can link it:
sudo  ln  -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

Make sure PHP is configured properly on your Nginx server to process the phpMyAdmin files.

Step 4: Accessing phpMyAdmin

Open your web browser and go to the following URL to access phpMyAdmin:


Log in using the username "root" and the password you set during the phpMyAdmin package configuration.

Step 5: Secure phpMyAdmin

Considering security practices are crucial, especially if your Raspberry Pi is accessible over the internet. Some steps to secure phpMyAdmin include:

  • Restrict access to phpMyAdmin directory using web server configuration or .htaccess file.
  • Regularly update your passwords and use strong, unique passwords for database access.
  • Consider setting up SSL/TLS to encrypt the connection to your web server.


Installing phpMyAdmin on your Raspberry Pi enhances your ability to manage databases for web projects or any other application that uses MySQL or MariaDB. With phpMyAdmin, you can easily create, modify, and delete databases, execute SQL statements, and manage users and permissions from a convenient web interface. Remember to take appropriate security measures to protect your database and server from unauthorized access.