phpMyAdmin Your Way to Database Management Bliss

The latest OpenShift Express release really makes it easy for developers to manage their MySQL databases.  With the addition of phpMyAdmin, any application type (JBoss, Ruby, Python, PHP, Perl) can easily administer MySQL.  That’s right – ANY application type – you don’t need to create PHP applications in order to use the phpMyAdmin support.  To show you how freakin cool this is, I’m going to deploy Redmine (a RoR developed application for project management and then use the phpMyAdmin interface to do cool things like browse, export, import, and modify rows in the database.

If you’re following along at home, I’m going to use the github quickstart repository to deploy the initial Redmine application and database before switching over to phpMyAdmin.

Step 1: Create a new OpenShift

rack-1.1 application
rhc app create redmine ruby-1.8

Step 2:Add MySQL support to the new application – make a note of the admin password and connection URL – we’ll use them in Step 4

rhc cartridge add mysql-5.1 -a redmine

Step 3:Add the Redmine github repository to your new OpenShift application

cd redmine
rm -rf *
git remote add upstream -m master git://
git pull -s recursive -X theirs upstream master

Step 4: Update config/database.yml with the correct database information for ‘production’.  In my case the ‘production’ section changes from:

  adapter: mysql
  database: redmine
  host: Database host provided by openshift
  username: admin
  password: password provided by openshift
  encoding: utf8


  adapter: mysql
  database: redmine
  username: admin
  password: 3UxHRUL1lR9d
  encoding: utf8

Step 5: Commit and push!

git commit -a -m “update database connection information”
git push

At this point you should be able to visit http://redmine-[yourdomain]  Try it out by logging in as admin/admin and create a new project.

When you’re ready, come back to get it on with phpMyAdmin.

Deploying phpMyAdmin on top of a running Express application is so simple my mom could do it!  Using a similar command line to how we add support for MySQL, we’ll run:

rhc cartridge add phpmyadmin-3.4 -a redmine

Once this is finished, you can go back to your browser and access https://redmine-[yourdomain]

Woah, slow down David, this is asking me for a password!  Yep, we don’t want to make database administration unsecure (also note how I’m using https)!  The username here is ‘admin’ and the password is the mysql password you added to config/database.yml.

You should now see the [maybe] familiar phpMyAdmin interface.  You can select the ‘redmine’ database from the database browser on the left.  Let’s do that and then find the ‘projects’ table.  From this interface, we could go in and edit individual fields for the test project we created.

Being able to edit fields in the database probably isn’t that important since your application most likely has a user interface for supporting this kind of thing.

However, your application probably doesn’t have the ability to easily import and export database dumps.  Using the features built in to phpMyAdmin you can manage the lifecycle of your applications backend datastore without the hastle of googling for MySQL command line help!

The other great thing about this support is that you can migrate from one OpenShift Express application to another – making it easy to have a dev environment and a production environment all hosted in the cloud!

Thanks for tuning in!

MySQL, OpenShift Online
Comments are closed.