Saturday, 14 September 2013

How to install PhpMyAdmin on a Raspberry Pi

A simple to use browser based MySQL database configuration tool for the Raspberry Pi

If you followed my tutorial on building a Pi web server, and also installed MySQL and PHP, then you'll probably want to install phpmyadmin - which is a handy web browser based administration tool for managing your MySQL databases.

Installing phpmyadmin

Login to your pi and download and install the phpmyadmin package:

$ sudo apt-get install phpmyadmin

When prompted to select which dbconfig tool, select lighttpd. Lighttpd was the web server you installed when you followed my tutorial on installing the web server.

When asked if you want to configure with db-config, select Yes. You'll then get asked for the MySQL root password you entered when you built the MySQL server. Enter it when asked, and again to confirm. Note, this is different and separate from your root login password.

Once the installation is complete, you need to make a link in your web root to where the phpmyadmin scripts are.

$ ln -s /usr/share/phpmyadmin phpmyadmin

This creates a folder on your web server called phpmyadmin which calls the scripts installed in /usr/share/phpmyadmin. You could use any name you like for the folder on the web server, but it needs to link to /usr/share/phpmyadmin.

Let's now test it, by pointing your PC's browser to the folder you made on the web server, in this case, the IP address of your Pi followed by /phpmyadmin

You'll be asked for the MySQL login and password you created.

If you get a warning message on the login screen, or any further screens, that mcrypt is not installed or enabled, install it:

$ sudo apt-get install php5-mcrypt

If the error persists, or you get told that it's already installed, you need to fix the PHP config.

Fix the PHP config file for some common problems
$ sudo vi /etc/php5/cgi/php.ini
Uncomment the line:

Now restart the web server again:
$ sudo service lighttpd force-reload

There's more to write yet for this tutorial, including adding some scripts, and creating limited access users for specific tasks. Please keep coming back to see what I've added.

No comments:

Post a Comment