How to Install PHPMyAdmin on the Raspberry Pi?

The Raspberry Pi is a popular single-board computer that allows users to create their own low-cost servers and devices. Installing PHPMyAdmin on the Raspberry Pi enables you to easily manage MySQL databases locally from the Raspberry Pi.

How to Install PHPMyAdmin on the Raspberry Pi?

Benefits of Installing PHPMyAdmin on the Raspberry Pi

There are several advantages to installing PHPMyAdmin on a Raspberry Pi:

  • Provides a user-friendly web interface to manage MySQL databases instead of using the command line
  • Useful for web development projects that require a database backend
  • Allows centralized access to databases stored on the Raspberry Pi from other devices on the local network
  • Free and open-source tool with an active developer community


Before installing PHPMyAdmin, you’ll need:

  • A Raspberry Pi model with network connectivity
  • Raspbian (or another Linux distribution) installed on the Raspberry Pi
  • Apache web server installed on the Raspberry Pi
  • MySQL database server installed on the Raspberry Pi
  • Basic Linux command line knowledge

I’ll provide commands and steps for Raspbian based on the latest version of Raspbian Stretch.

Installing the LAMP Stack

PHPMyAdmin requires a LAMP (Linux, Apache, MySQL, PHP) stack to run. Here are quick steps to get LAMP installed:

  1. Update apt repositories


sudo apt update

sudo apt upgrade

Install Apache, MySQL, and PHP


sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql

Enable Apache modules


sudo a2enmod rewrite

sudo systemctl restart apache2

Secure the MySQL installation


  1. sudo mysql_secure_installation

Follow the prompts to remove anonymous users, disable remote root login, and set a root password.

Downloading and Configuring PHPMyAdmin

With the LAMP stack set up, we can now install PHPMyAdmin:

  1. Install PHPMyAdmin and its dependencies


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

Configure Apache to use PHPMyAdmin


sudo phpenmod mbstring

sudo systemctl restart apache2

Secure PHPMyAdmin with an authentication method


sudo nano /etc/phpmyadmin/

Under the Authentication Type section, uncomment and configure either the cookie or http auth option to enable user login.

Optionally create a symbolic link


  1. sudo ln -s /usr/share/phpmyadmin /var/www/html

    This will allow accessing PHPMyAdmin directly at your Pi’s IP address.

You can now access the PHPMyAdmin interface in a web browser at http://your_pi_ip/phpmyadmin. Use your MySQL credentials to log in and manage databases.

Securing PHPMyAdmin

Since PHPMyAdmin provides full access to your MySQL server, it’s very important to secure it. Here are some tips:

  • Set up Apache HTTP authentication or cookie authentication in
  • Create a strong username/password auth credential if using HTTP auth.
  • Disable remote MySQL root login privileges and create limited user accounts for web applications.
  • Use SSH tunneling or VPN instead of opening PHPMyAdmin ports in the firewall.
  • Install security monitoring tools like fail2ban on your Raspberry Pi.


Installing PHPMyAdmin is an easy way to get a web-based interface for MySQL administration on your Raspberry Pi. It allows you to simplify database management for web applications.

Just be sure to take precautions to properly secure PHPMyAdmin. Limit network exposure, create restricted user accounts for web apps, and consider tunneling traffic to PHPMyAdmin.

With a properly configured LAMP stack and some good security practices, you’ll have a solid environment for creating database-backed apps on your Raspberry Pi.

Key Takeaways

  • PHPMyAdmin offers convenient web access for MySQL management on a Raspberry Pi
  • Install LAMP (Linux, Apache, MySQL, PHP) stack first
  • Secure PHPMyAdmin user authentication and restrict MySQL permissions
  • Limit PHPMyAdmin network exposure for security best practices

 Frequently Asked Questions 

  1. What is the default username and password to log in to PHPMyAdmin?
    The default username is “root” and there is no password set. It’s highly recommended to choose a strong password during the MySQL installation process for better security.

  2. Where are PHPMyAdmin databases stored on the Raspberry Pi?
    Database files created using PHPMyAdmin are stored in the standard MySQL data directory, usually /var/lib/mysql/ on Raspbian.

  3. Can I access PHPMyAdmin databases from another computer?
    Yes, as long as the Raspberry Pi running PHPMyAdmin is connected to your local network. You would navigate to the Pi’s IP address followed by /phpmyadmin in the browser URL bar (like

  4. Does installing PHPMyAdmin impact Raspberry Pi performance?
    There is a small additional system resource demand running MySQL, Apache and PHP. But modern Raspberry Pi boards have sufficient performance headroom to run PHPMyAdmin without issues for light/moderate database workloads.

  5. Can I uninstall or remove PHPMyAdmin later?
    Yes, you can remove the phpmyadmin package using the standard sudo apt remove phpmyadmin command. This will uninstall PHPMyAdmin but won’t remove MySQL or impact existing databases.

  6. Can I backup my PHPMyAdmin databases?
    Yes! PHPMyAdmin makes database backups easy. You can export a database as a SQL file or other format. It’s also a good idea to setup regular MySQL backups to preserve data.

  7. Does PHPMyAdmin work on any Raspberry Pi models?
    PHPMyAdmin can be installed on any 40-pin GPIO Raspberry Pi model (A+/B+/2/3/4). Very old models like the Pi 1 with 26-pin GPIO won’t work. A Pi 4 handles PHPMyAdmin best.

  8. Can I manage SQLite databases with PHPMyAdmin?
    No, PHPMyAdmin only supports MySQL/MariaDB databases. Other tools like phpLiteAdmin allow web management of SQLite databases instead.

  9. Is PHPMyAdmin optimized for the Raspberry Pi platform?
    PHPMyAdmin is designed to work well on common web hosting platforms like Apache/Linux so it runs great on a Raspberry Pi. No special optimization is required, beyond tuning MySQL for best performance based on your workload.

  10. Can I make modifications/customizations to PHPMyAdmin’s interface?
    Yes, PHPMyAdmin is open source so you can modify scripts and stylesheets to customize the interface. You can also extend functionality with plugins.

  11. Does PHPMyAdmin support managing users/privileges?
    Absolutely! Granting users access to specific databases or tables and setting privileges is a core function of PHPMyAdmin. This allows secure database access control.

  12. How do I change which database I am viewing in PHPMyAdmin?
    Use the navigation links at the top of the screen. Click on a database name to change the context to that database. You can also use the dropdown menu to switch.

  13. Can I import and export databases with PHPMyAdmin on a Raspberry Pi?
    Yes, importing and exporting SQL database dumps or other structured data files is built into PHPMyAdmin for easy migration between databases and servers.

  14. Is there a desktop application version of PHPMyAdmin?
    PHPMyAdmin is designed as a web application. But there are desktop database tools like MySQL Workbench that offer similar database administration capabilities while running natively.

  15. Can I connect remotely to the Raspberry Pi’s PHPMyAdmin over the internet?
    This is possible by port forwarding port 80 or 443 over the internet to your router and Raspberry Pi IP. But due to security risks, using a VPN tunnel is strongly recommended instead of opening PHPMyAdmin directly to the internet.

  16. How do I change the language used in the PHPMyAdmin interface?
    Navigate to the Preferences tab. Then open the “Interface and display” section and select your desired language from the options available. The change takes effect on page reload.

  17. Can I manage multiple MySQL servers from a single PHPMyAdmin instance
    PHPMyAdmin can manage a single MySQL server only. But you can install multiple instances of PHPMyAdmin pointing to different MySQL servers on subdomains or subfolders to achieve a similar centralized database management capability.

  18. What PHP extensions does PHPMyAdmin require?
    PHPMyAdmin requires the php-mbstring, php-zip, php-gd, php-json, and php-curl extensions. The installation steps cover installing these needed extensions.

  19. Can I access PHPMyAdmin over HTTPS for better security?
    Yes, you can enable HTTPS access by installing an SSL certificate and configuring the Apache web server accordingly. Using HTTPS is recommended to encrypt traffic to PHPMyAdmin.

  20. Does PHPMyAdmin work with MySQL alternatives like MariaDB?
    Yes, PHPMyAdmin is compatible with the MariaDB fork of MySQL. All MySQL commands will function the same when using PHPMyAdmin with MariaDB instead.

Leave a Comment