Tutorial – Install PhpMyAdmin on your Raspberry Pi

PhpMyAdmin is a handy web interface for managing local MySQL databases, and can make database queries, management and backups easy.

In this tutorial, I’m going to talk you through installing PhpMyAdmin on your Raspberry Pi powered web server. I’m assuming you’ve got Raspbian installed, and you’ve followed my tutorial: install Apache, PHP and MySQL on Raspberry Pi.

Step 1 – Begin the PhpMyAdmin installation

From terminal, we begin by changing to the root user in terminal by entering:

sudo bash

Now we need to install the PhpMyAdmin package using:

apt-get install phpmyadmin

The package will begin installing. You will be asked which web server is installed, choose apache2.

My screenshots show purple, but you’ll see blue. I’ve already got PhpMyAdmin installed on my Raspberry Pi so had to install it on a ubuntu VM for the purpose of this tutorial – apologies for the wrong colours, but I can assure you the procedure is the same for Debian/Raspbian and Ubuntu!

Step 2 – configure for dbconfig-common

Next we’ll need to configure PhpMyAdmin’s database. You’ll see the following prompt:

When prompted, choose Yes. Next you’ll be asked for an administrative password, this is the root password that was set during the MySQL installation in the previous tutorial.

You’ll be asked to set a password for PhpMySQL. I’ve used the same password as the MySQL root password, but its up to you what you set here. Make a note of it somewhere.

That’s PhpMyAdmin installed. Next we need to change the apache configuration to allow us to use http://your.raspberrypi.domain/phpmyadmin to access it.

Step 3 – Configure Apache to work with PhpMyAdmin

We need to alter the Apache configuration in order to access PhpMyAdmin. To do this, enter the following command to alter the configuration:

nano /etc/apache2/apache2.conf

The configuration file will load in Nano. Navigate to the bottom of the file (keep pressing CTRL + V to jump page by page until you’re at the bottom of the file) and add the following new line to the file:

Include /etc/phpmyadmin/apache.conf

Save the file (CTRL + X and enter Y when prompted to save) and restart Apache2. To restart Apache, enter the following command:

/etc/init.d/apache2 restart

That’s it! You’re all installed and ready to go. Give accessing it a try by going to your Raspberry Pi’s IP address or domain name and add ‘/phpmyadmin’ to the end in your web browser, ie http://your.raspberrypi.domain/phpmyadmin. 

As always your comments are welcome, feel free to leave one below. My next tutorial will guide you through installing WordPress through terminal, and hosting your first WordPress site on your Raspberry Pi web server.

 

25 thoughts on “Tutorial – Install PhpMyAdmin on your Raspberry Pi

  1. I installed phpmyadmin on raspberry pi but left frame is not displayed (navigations.php)

    You think you can help me with this problem?
    thanks.

    • Hi Ion

      It looks like a file is missing from your installation. From terminal type:

      cd /usr/share/phpmyadmin && ls
      

      Is there a ‘navigation.php’ there? If not, I’ll zip mine up and give instruction on how to import this into your installation.

    • Are you using chrome? If you are, right click anywhere on the phpMyAdmin page and click ‘inspect element’. Click on ‘console’ and let me know if there are any errors or missing files. Failing that we could look at repairing your installation, but that wouldn’t tell us what’s not working.

  2. I have installed apache2, mysql, php and myadmin as per your instructions (I thinbk) and got the phpmyadin screen displaying. What username and password are being asked for though – I tried pi with the password I selected for phpmyadmin and mysql and get error sannot connect to mysql … am pretty sure the error is just wrong username …. what name should i be using?

  3. Thank you for the excellent tutorials; they certainly saved me a huge amount of research time.

    It is amazing what this little machine can do. :)

  4. Got to the part where we were supposed to add

    Include /etc/phpmyadmin/apache.conf

    pressed CTRL+X and then Y and got a message

    “Error writing /etc/phpmyadmin/apache.conf: permission denied

    Is there a way to resolve this issue? I don’t know anything about Linux… But so far your tutorials have made it easy!

    • Hi there.

      Did you start with ‘sudo bash’, this essentially lets you do things with elevated privlages, so should allow you to write the file.

      Try ‘sudo nano /etc/apache2/apache2.conf’ instead of ‘nano /etc/apache2/apache2.conf’ and you should be able to make the change to the file. Any problems, leave another message and I’ll help how I can.

  5. Ok this time it let me save the file but after typing in the line to restart Apache a bunch of text comes up that reads

    “syntax error on line 43 of /etc/phpmyadmin/apache.conf”

    Says the same thing probably 100 times over and over… At the bottom it says

    “Action ‘configtest’ failed.
    The apache error log may have more information.
    failed!” (red font)

    Before when I couldn’t save the file I could still reach the Apache server by going to its IP address on another computer but now it is not finding it… Because of this error I would assume… Is it how I edited the file? I did exactly as you said, key-down to the bottom of the file then insert the following

    ” Include /etc/phpmyadmin/apache.conf”

    So the last 3 lines looks something like this
    .
    .
    .
    # Include the virtual host configurations:
    Include sites-enabled/
    Include /etc/phpmyadmin/apache.conf (What I added)

  6. At some point I must have accidentally went into ‘phpmyadmin/apache.conf’ and added: Include /etc/phpmyadmin/apache.conf

    Right thing to add but wrong file… Once I discovered this, deleted the line, and rebooted my pi it seems to work!!!

    My next problem is at phpMyAdmin is the username ‘pi’ I keep trying this and it produces an error #1045 I don’t recall you having me set up another username…

  7. So i followed your tutorials, but when i go to the website “jgpallo.zapto.org/phpmyadmin” it shows nothing, just an empty page with an error saying the page could not be found.

  8. Hello,
    Thanks for the tutorial! Everything went smoothly, except it never asked me for a password. So when I try to login as the root user obviously it doesn’t work. Do you have any suggestions? Is there a way to reset the password possibly?

    Thanks,
    Nick

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>