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.


41 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?

    1. 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.

    1. 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.

    1. Why thank you Dr! Glad you like the site and found it to be beneficial. I did the header image, it was done in Adobe Fireworks

  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!

    1. 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)

        1. Me too, I would love to get a website like one you have here! It’s exceptional and I hope I’ll be able to have something like this someday! Thanks for the great work so far!! Keep it coming, for all of us Ste W :)

  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?


  9. Hi,

    Thanks for an excellent guide! I’ve managed to install everything and it’s working, but I got a problem. When opening the wordpress site inside my LAN, the site loads very quick, but when outside it terrible slow. So slow that the theme isnt even loaded but only the text. The content on my other pi loads fast so it’s not the connection speed. I’ve installed using your guide on the pi in my living room running Raspbmc but that doesn’t seem to be the problem since the pages loads fast locally and the xbmc remote page is fast even outside the network. Something I could do that would speed things up, is it some kind of setting?

    Thanks a lot!

  10. 404 Not Found…
    Followed the instructions but when I try to direct the browser to the phpmyadmin it sys 404 Not Found.
    I can access other webpages on my domain name running on the Pi

  11. Hi there,

    I had a small problem at the “apache2 restart” step with the message:

    apache2: bad user name ${APACHE_RUN_USER}

    but I found that the sequence

    apache2 stop
    apache2 start

    worked fine and now I have phpMyAdmin working.

    Thanks for the tutorials.

  12. Hi,

    This had me scratching my head for a while and was wondering if you know what’s going on!

    When I go to my-site/phpmyadmin , my browser displays what looks like some source code. To get the login page I have to go to my-site/phpmyadmin/index.php, where everything works as it should.

    Is there something I can do to make /phpmyadmin load the login page as it should?

    Thanks for all the really useful info on your site!


  13. message received
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using │
    │ password: YES)
    when I ran apt-get install phpmyadmin.

  14. Hi
    I keep getting a error saying I cannot login to MySQL server and ” connection for control user as defined in your configuration failed”

    Any ideas anyone??

  15. I experienced the same problem as jp. I could not log in to the mysql database although I was sure what my password was because I just entered it in the installation routine.
    I always received an error:

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    if I used no password (mysql -u root) or

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES).

    with a password (mysql -u root -p).

    The cause of the problem was that there was no entry in the user table for the root user. The solution was to insert one:

    # stop mysql database:
    sudo service mysql stop
    # run database without acces permission control
    sudo mysqld_safe --skip-grant-tables --user=root
    # insert new user
    insert into user (host, user, password) values ('localhost', 'root', PASSWORD('mypassword'));
    # stop mysql database
    killall mysqld_safe
    # restart "normal" mysql database
    sudo service mysql start

  16. Great tutorials, many thanks.
    Just getting going with my Pi web server after creating a wordpress website recently, and wanted a stand alone test machine. All went perfectly well. WordPress on too and happily running for me.

    Thanks again.

  17. mysqladmin -u root password 'passwordyouwant'
    should do the trick the simple way. After that
    mysql -u root -p
    If it asks for a password everythng should be okay and you should enter the ‘passwordyouwant’

  18. Great Work i followed step by step and it work perfectly.

    i have 2 questions. how can i connect to msyql databse with Navicad For Mysql.

    I enter the ip address of the pi on local network, username and password for database but it cant connect. i am using port 3306.

    How can i install FTP server so i can uplaod files with ftp software?

    Thanks for your great work.

  19. Hai,

    Nice tutorial, great work
    Can you tell me how to upgrade to example Mysql 4.1.6 and leaving this config
    as it is if possible.


  20. Hello,

    thanks for this tutorial, I did it as it is instructed, thanks again.
    Btw, I have another problem,
    Well, I have 1 raspberrypi and 1 windows server (PC) which already has mysql (phpmyadmin) inside it ( I use PC with windows os as a server).
    I need to insert data by using a python script inside the raspberrypi (I work from the raspberrypi) but the data must go to the windows server (it doesn’t work yet), the point is, inside raspberrypi only has python script to insert data and the mysql-client, and the windows server only has the mysql phpmyadmin.
    I can ping from Raspberrypi to the windows server and vice versa, meaning they are both connected each other.
    In phpmyadmin (in the PC server), under privilege menu, I already setup to letting the raspberrypi’s IP to either insert or delete the data, but it does not work yet.
    Did I miss something?
    Would you please let me know the correct setting and guide me step by step?
    Many thanks.


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>