Install PhpMyAdmin On A Raspberry Pi

by | Jun 12, 2016

PhpMyAdmin LogoIn this tutorial I will show you how to install phpMyAdmin on a Raspberry Pi, phpMyAdmin is a free tool that has been designed to allow for easy administration of MySQL via a browser. If you have never used a relational database like MySQL (MariaDB) then phpMyAdmin may seem quite confusing, I would suggest reading some MariaDB tutorials first.

To use phpMyAdmin you first need to configure a Web Server on your Pi to load the Apache web server and MySQL (MariaDB) database management system, this includes making sure that you have a root MySQL (MariaDB) account and a password. Without these things already loaded onto your Pi you will not be able to install phpMyAdmin.

To configure the Pi I am assuming that you are running the latest version of Raspbian and have the ability to connect to your Pi either through SSH with Putty and FTP with Filezilla,  or directly with a keyboard and monitor if you haven’t set-up your Pi yet then check out my getting started section.

 

Materials

 

In this tutorial I will be using the following materials:

 

Install PhpMyAdmin

 

To begin, ensure that Raspbian is running the latest packages by executing the following commands

 

 

To install PhpMyAdmin on the Pi we need to import and activate the following package

 

 

During the install you will be presented with the following screen asking what type of server you are running, select “apache2” and continue

 

PHPMyAdmin Select Server Type Screenshot

 

Next we will need to configure phpMyAdmin to connect the MySQL database. If you have already created a database you can just select Yes and continue, if not then go back to the Web Server configuration tutorial and install MySQL (MariaDB).

 

PHPMyAdmin Config Select Screenshot

 

When requested create a password for phpMyAdmin and select “OK”, while it can be the same, to improve the security of the MySQL (MariaDB) server consider a different password, just make sure that you remember what it is.

 

PHPMyAdmin Password Screenshot

 

You will now be requested to confirm the password. For security reasons phpMyAdmin will not allow you to login as the root user, to overcome this you will need to create a new user.

Open MySQL using the root user

 

 

Then create a database, in this case, we will call it “hydropidb”

 

 

Next, we will create a new user and password, for this example, the username will be “piuser” and the password will be “pipasswd”

 

 

Now that the new user has been created we will grant all privileges to this user so that you can work with the database.

 

 

In order to enable the new user to access the new database, we have to flush the privileges table with the following command. Once completed “Quit” out of the MySQL program

 

 

Log back into MySQL as the new user to confirm access.

 

 

 

Configure Apache for PhpMyAdmin

 

With phpMyAdmin now added we need to go back to the Apache server and let it know about the new installation, to do this we will need to edit the apache2.conf file on the Pi with the following command.

 

 

Scroll to the bottom of the file and add the following line

 

 

Press Ctrl+X, Y and enter to save the changes. Next, we will restart the Apache server to activate our changes

 

 

After the server has restarted you should now be able to access phpMyAdmin using a web browser. Open up a browser session and in the address bar enter your IP address followed by phpMyAdmin, eg.

 

 

You will be presented with a login screen where you enter the user and password you just created.

 

PHPMyAdmin Login Page Screenshot

 

Once logged in you will be presented with the database management screen shown below.

 

PHPMyAdmin Main Page Screenshot

 

At this stage phpMyAdmin has been installed successfully and you now have a visual interface to your database, If you would like to learn more about MySQL (MariaDB) and the commands to manage the database then I recommend TutorialsPoint who offer a wide range of excellent MariaDB tutorials, all for free.

If you have any thought’s about this article, improvements or errors let me know in the comments below and if you found this helpful, why not share it with others.

Pin It on Pinterest

Share This