runtime/faq/install phpmyadmin

From JumpBox Documentation Wiki

Jump to: navigation, search

How do I get phpMyAdmin to work?

WARNING - Test this on a non production JumpBox of the same type and version before doing it on a production JumpBox.

NOTE - The LAMPd and MySQLd JumpBoxes already have PhpMyAdmin installed.

PHPMyAdmin is a Web based MySQL Administration tool. You might find it handy on a JumpBox that uses MySQL (Drupal, Joomla, MediaWiki, PunBB, vTiger, SugarCRM, and WordPress). It doesn't come installed on a JumpBox by default, but installing it is not too complicated. Just enable shell access, SSH to your JumpBox as admin and follow these instructions:

sudo apt-get update
sudo apt-get install phpmyadmin

During the install of this package you will be asked which webserver it should automatically configure phpmyadmin for, you should select "apache2" and then click OK as shown in the following picture:

Phpmyadmin install.png

Now we need to setup basic HTTP Authentication to prevent unauthorized access to your database. First off, set a password for the admin user in the htpasswd.setup file that came with phpmyadmin:

sudo htpasswd /etc/phpmyadmin/htpasswd.setup admin

Then we want edit the phpmyadmin apache.conf to force basic auth for all of phpmyadmin:

sudo nano /etc/phpmyadmin/apache.conf

add the basic auth configuration lines directly after the "DirectoryIndex index.php" statement as shown here:

<Directory /usr/share/phpmyadmin>
       Options Indexes FollowSymLinks
       DirectoryIndex index.php
       # Begin Basic Auth Declarations
       AuthType Basic
       AuthName "phpMyAdmin"
       AuthUserFile /etc/phpmyadmin/htpasswd.setup
       Require valid-user

Restart apache:

sudo /etc/init.d/apache2 restart

Accessing phpMyAdmin

Now to access PHPMyAdmin on your JumpBox just point your browser to http://jumpboxip/phpmyadmin. First, a dialog box will ask for a username and password, you should use admin and the password you set above with the htpasswd command. Then when you see the phpmyadmin login screen you will use the username root, and the password your find using the command below:

grep root /jumpbox/lib/appdata.yml

NOTE: 'sudo' is a command that lets the admin user do things as the privileged root user. The first time you run it, it will ask you for the admin user's password. The admin user can do anything on the JumpBox using this command.

NOTE: There are a number of different ways to restrict access to phpMyAdmin. This is the recommended method as of when this document was written. Deviation from these instructions could result in the unauthorized access to your database.

Views
Personal tools