How to install phpMyAdmin on your Cloud App

NOTE - The LAMPd and MySQLd Cloud Apps already have PhpMyAdmin installed.

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

before you start installing phpmyadmin you need to ssh into the box and run:

sudo grep root /jumpbox/lib/appdata.yml

The resulting password is the one you need to use when it creates the database for phpmyadmin.

Next type:

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 Cloud App just point your browser to http://yourIP/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.

NOTE: Should you get a 404 "Not Found" error when you point your browser to the location of phpMyAdmin (such as: http://yourIP/phpmyadmin) this is likely caused by not checking the 'Apache 2' selection during installation. To redo the installation run the following:

 sudo dpkg-reconfigure -plow phpmyadmin

Enjoy!



Share this post


Comments