X
 

Install PhpMyAdmin On A Raspberry Pi

by | Jun 12, 2022 | 12 comments

Raspberry Pi and phpMyAdmin

 

This post is a follow up to my previous instruction, configuring a Raspberry Pi web server which covers loading the Apache web server and MySQL database management system. phpMyAdmin is a free tool that has been designed to allow for easy administration of MySQL via a browser. It is used in many web server environments throughout the world.

To configure the RPi I am assuming that you are running the latest version of Raspian 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 RPi yet then check out my getting started section.

To install phpMyAdmin on a Raspberry Pi we need to import and activate the following package

 

sudo apt-get install phpmyadmin

 

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

 

 

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

 

 

When requested use the password for your MySQL database that you created during the Web Server configuration post

 

 

You will now be requested to provide a  phpMyAdmin password and reconfirm, you can either use the same password as your database or choose another just make sure that you remember what it is otherwise you will not be able to log in.

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 RPi with the following commands

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

 

Include /etc/phpmyadmin/apache.conf

 

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

 

sudo /etc/init.d/apache2 restart

 

After the server has restarted open up a browser session and in the address bar enter your IP address followed by phpMyAdmin, eg. 192.168.1.20/phpmyadmin, You will be presented with a login screen where you enter the user as root and your MySQL database password.

 

 

who

Now that phpMyAdmin has been installed you now have a visual interface to your database, If you would like to learn more about MySQL and the commands to manage the database then I recommend the folks over at guru99.com who offer a wide range of excellent SQL 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.