Setting up phpMyAdmin and MySQL on Raspberry Pi

As part of my ongoing efforts to create a really awesome alarm clock with my Raspberry Pi, I had to set up some MySQL databases. I have very little experience with MySQL, and the idea of setting up tables, users, and all that jazz via the command line was daunting. My dad (a programming pro!) suggested that I install a browser-based MySQL manager, like phpMyAdmin. A GUI sounded like a wonderful idea, but it has taken a bit of work, so I'm documenting it here. For those of you that haven't read my previous posts, I am running an Nginx server on the Pi.


Make sure you have PHP5 (or above) and MySQL5 (or above installed):

$ php -v
PHP 5.4.4-14 (cli) (built: Mar  7 2013 08:56:46)
$ mysql -V
mysql  Ver 14.14 Distrib 5.5.30, for debian-linux-gnu (armv7l) using readline 6.2

I also read that installing libmcrypt was a good idea, so I did:

sudo apt-get install php5-mcrypt

If you don't have these packages installed, follow the instructions I wrote in this previous post to install PHP and MySQL.


First, you'll need to download phpMyAdmin onto the Pi. The package has to be installed in a certain location too, so we might as well get to the right location first. phpMyAdmin needs to be installed in the root directory of your server. In my case, the root directory is just a folder named “www” in my user's directory. So, we cd into that directory:

cd ~/www

The next step is to download phpMyAdmin. I went to the phpMyAdmin website and downloaded a .tar of the files directly into my /www directory:


Please note that this URL is for the current version of the software, but depending on when you read this, it may no longer be the current version. All you need to do is replace the url with the url of the most recent download – you can find this by right-clicking on the download link and selecting “Copy Link Address.” I went for the “-english.tar.gz” version of the download.

Next, we must extract the files. You may want to rename the package; when I downloaded it, the name of the tar file had extra garbage at the end, so I just deleted everything after the .tar.gz extension.

tar -xvfz phpMyAdmin-4.0.1-english.tar.gz

Next, rename the extracted folder to phpmyadmin

mv phpMyAdmin-4.0.1-english.tar.gz phpmyadmin

You should now have a folder called phpmyadmin within your web server's root directory. My file-path looks like this:



The next step is to configure phpMyAdmin. First, create a dummy file:

cd /home/my_user/www/phpmyadmin/
mkdir config
chmod o+rw config
cp config/
chmod o+w config/

Next we open up a browser and start the configuration wizard. My RPi is on my local network with a static IP, so in my browser I navigate to: You should be greeted with a screen that looks something like this:

Setting up phpMyAdmin and MySQL on Raspberry Pi

Click the “new server” button. You'll need to enter a few things. First, in the “Basic Settings” tab, I named the server. I also selected “Use SSL.” I left all the other options blank to keep the defaults.


In the “Authentication” tab I entered information for the config author. I used the password that I gave MySQL during the MySQL installation because I'm fairly certain that phpMyAdmin will use these credentials to log in to MySQl. I left “config auth” as the default, “root” and also left “authentication type” as the default “cookie.”


Read more: Setting up phpMyAdmin and MySQL on Raspberry Pi

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

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

Scroll to Top