Using Adminer with MAMP on Mac OS X

So, thanks to a tip from a friend, I discovered a script called Adminer. It’s built to replace PHPmyAdmin and focuses on speed, security and user interface. While I’m not entirely sure that it will become my day to day database management tool, from what I’ve seen so far, I really dig it.

Setting up Adminer is a no-brainer. Just put it in a directory that’s accessible to run PHP scripts and hit the URL in your browser. You’ll get a login screen and be off and running. Seriously, it’s that easy. No configuration whatsoever. The English and MySQL-only version that I’m running is just 158kb too! Pretty awesome, right?

Most of my database management I do locally when I’m developing a new website. On my Mac, I run the program MAMP (Mac, Apache, MySQL, PHP). There’s Windows and Linux versions of the software too. When MAMP launches it loads the start page automatically in your default browser. I wanted to create a link from MAMP to Adminer just like you get for PHPmyAdmin on the start page.

Here’s how I did it… For the purposes of this tutorial, we’ll assume you’re using the English version.

First, decide on where you’ll install Adminer. Since all my PHP files are served from the Sites directory, I decided on ‘Sites/utilities/adminer’. I renamed the default adminer.php file to index.php so that whenever the directory is hit within a browser, it automatically loads. So now the absolute URL to Adminer would be:

http://localhost:8888/utilities/adminer/index.php

Now, open the MAMP folder. Mine is located at ‘Username > Applications > MAMP’. Now open the ‘bin > mamp > English’ folder. Duplicate the ‘navigation.inc.php’ file so that you have a backup should you need it.

Open the file in your favorite code editor. Around line 14 you’ll see the following code.

<li><a href="frame.php?src=<?php print rawurlencode("/phpMyAdmin/?lang=en-iso-8859-1"); ?>&amp;language=<?php print $language; ?>"><img alt="" src="images/bullet<?php print ($hl=="phpmyadmin") ? "_active" : ""; ?>.gif" border="0" class="bullet" />phpMyAdmin</a></li>

After this code block, on a new line add the following code:

<li><a href="http://localhost:8888/utilities/adminer/index.php"><img alt="" src="images/bullet.gif" border="0" class="bullet" />Adminer</a></li>

Replace the absolute URL referenced in the code with the location of your Adminer install.

You’re done! If you want a bit more Adminer flavor, pick and install one of the CSS skins. So much nicer to look at than the default style.