Skip to main content.
July 2nd, 2003

Installing phpMyAdmin on Mac OS X

Pre-requisite reading: Mac Serving With Apache, PHP, and MySQL

Now that we’ve already set up Apache, PHP, and MySQL, it’s time to install and configure a database management tool. Database management tools are used to create, edit, and browse database structures and content. Installing a separate database management tool isn’t strictly necessary; after all, the Terminal can be used to perform all MySQL database functions. But the reason we use Macs is that we prefer graphical interfaces to command lines, right?

While there have traditionally been very few SQL database management options for the Mac, the number has grown steadily over the last twelve months. For the purposes of this tutorial we will focus on phpMyAdmin; an in-depth look at the various alternative database management options will be reserved for a future article.

[Note: This is a live document and will be constantly refined to make sure it assumes no prior knowledge or experience other than the pre-requisite reading listed above. If you have any trouble following the steps in any of our tutorials, please let us know.]

Installation

  1. Download the latest stable version of phpMyAdmin.
  2. Expand the downloaded archive with OpenUp or your preferred application. Rename the resulting folder to “phpMyAdmin” and copy it to either [Home]/Sites/ or to /Library/WebServer/Documents/ (see relevant article on where to store web files). For the purposes of this article, we will assume the latter location.
  3. Inside the phpMyAdmin folder, find and open the config.inc.php file with TextEdit or your preferred PHP-friendly text editor. Change the following line:

    $cfg[’PmaAbsoluteUri’] = ‘’;

    …to…

    $cfg[’PmaAbsoluteUri’] = ‘http://localhost/phpMyAdmin/’;

    [If your server has a domain name, substitute www.yourdomain.com in place of localhost above.]

  4. Further down will be a list of configuration variables starting with $cfg[’Servers’][$i]. The first line in that section is for the MySQL hostname. Enter localhost in between the empty single quotes (do not use www.mydomain.com, even if you have one for your server). The completed line should look like:

    $cfg[’Servers’][$i][’host’] = ‘localhost’; // MySQL control user settings

  5. Find the line that sets the MySQL controluser variable and in between the single quotes enter root. Then type the control user password that you set when you originally installed MySQL in between the single quotes following the controlpass setting, just below the controluser line.
  6. Enter the word cookie into the auth_type setting.
  7. Set the user and password to the same values as controluser and controlpass above. Select Save from the File menu.
  8. Make sure Apache and MySQL are started, and then load the following URL in your browser:
  9. http://localhost/phpMyAdmin/index.php

  10. Assuming all went well up until this point, an authentication dialog should appear. Enter root as the username and the same password as above to log into MySQL. Once the authentication step is complete, a “Welcome to phpMyAdmin” message should appear, along with a pop-list of databases on the left-hand side.
  11. Now we’re going to create a MySQL control user, which offers better security since we won’t have to log in as the root user for routine database maintenance. Click on “Add a new User” and enter a control username. Select the “Any Host” pop-up and switch to “Local” (localhost will appear in the text field). Type a password for the control user into both fields as indicated.
  12. Check the following checkboxes, leaving everything else alone: Select, Insert, Update, Delete, File, Create, Alter, Index, Drop, Grant, Process, Reload, Shutdown, and References. Hit the “Go” button, and you’ll see a “You have added a new user” confirmation screen.
  13. Now it’s time to log out, change the control user for phpMyAdmin, and log back in again. Click on the Home link at upper left. Click on “Log out” at the bottom of the right pane.
  14. Go back and edit the config.inc.php file so that the new control username replaces both instances of root, and change the password in both places to the new password for the control user.
  15. Go back to the phpMyAdmin page and log in as the control user to make sure everything is set up properly. After logging in successfully, you should see the same phpMyAdmin screen that you saw when you first logged in as the root MySQL user.

Wrap-Up

We now have full control of MySQL and can create additional users and new databases by clicking on the Create new database and Privileges sections at right. We will use the phpMyAdmin tool in future articles to create databases for use with e-commerce, content management, and other server applications.

Posted by Justin at 4:29 AM PDT — Tags: ,

This entry was posted on Wednesday, July 2nd, 2003 at 4:29 am and is filed under Tutorials. You can follow any responses to this entry through the comments RSS 2.0 feed. Both comments and pings are currently closed.

10 Responses to “Installing phpMyAdmin on Mac OS X”

  1. dombett says:

    I’ve followed the instructions for installing phpMyAdmin, but I keep getting the following error:

    Server localhost
    Error
    MySQL said:
    Access denied for user: “root@localhost” (using password: YES)

    Should I assume that I have the mySQL password wrong? If that’s the case and assuming that I have forgotten the mySQL password (or closer to the truth, misremembered it), is there a way to change it from the root user without having the old password?

  2. Justin says:

    If you think you might have forgotten it, the MySQL site has instructions on how to reset the root password [www.mysql.com].

  3. nkaforey says:

    Excellent and brief article. It got me up and running. Everything worked.

    I admit that I needed the handholding to get phpMyAdmin running. Your step by step instructions made all the difference.

    Thanks, let’s do more!

  4. WaltFrench says:

    The rote instructions are VERY HELPFUL. However, it’d be nice to have suggestions of where to turn when they don’t work.

    In my case, everything looked nice & smooth (including having a forgotten download, uEdit, invoked when I double-clicked on the php files). But then, when loading the config URL, I just got a blank screen (not my 404 error message, which another rote page had helped me to configure, after I loaded up all the junk ad URLs into my DNS).

    Any idea what gives? Bad pw? Conflict w/ my previous fooling around? (But not, methinks, a previous effort to load PHP) Where should I turn if I’m just trying to fool around & learn SQL/MySQL?

    “Inquiring Minds Want to Know!”

  5. Rower_CPU says:

    FYI, it’s also possible to set up phpMyAdmin with limited user accounts for different users. Very handy for servers with several projects/people working at once.

    It takes a little more work, but it works very well.

    http://www.phpmyadmin.net/documentation/#setup
    (scroll down to “Using authentication modes”)

  6. ghouser says:

    It finally worked for me. I had changed the host name to something other than localhost during system setup and had to go back and redo the hostconfig file, then I had to go back and add a password for MySQL root, which I forgot, then I had to switch from Safari to IE 5.2 because I couldn’t get Safari to load “localhost” even after resetting it, and then I had to click on “Show MySQL runtime information” and then “Privileges” to get the “Add new user” button to come up (MySQL 3.23.53 with phpMyAdmin 2.5.2-rc2 on an XServe), and I had a heck of a time logging out because it kept asking me for passwords until I finally just quit IE 5.2; but in the end it worked, and that made all the difference. Thanks.

  7. Anonymous says:

    very useful. just one more thing: the current versions of phpMyAdmin (for example the latest stable at the moment 2.5.6) require in addition to the password configurations as described in config.inc.php another variable. in the line

    $cfg[’blowfish_secret’] = ‘pass’;

    enter your password, which presumably will be encrypted succesfully wtih the “blowfish” algorithm when phpMyAdmin internally starts the config file.

  8. Gnarlodious says:

    Here’s a procedure to reset the root password:

    http://dev.mysql.com/doc/mysql/en/Resetting_permissions.html [dev.mysql.com]

    However I have not succeeded in finding the described mySQL PID file needed to send a shell command to quit the service.
    If you have a StartupItem to launch mySQL it should be possible to say:
    sudo -s
    root# systemstarter stop MySQL

    which works for me.

  9. Anonymous says:

    THANK YOU! Very helpful. Very well done.

  10. Anonymous says:

    FAN-Tastic. I’m forever grateful for articles like this that spell it out in plain English for us Isaac Newbs (wannabe genius).

    Only had a small issue with the blowfish passphrase thing, but I found the option for that near the top of the config file with ease.

    Thanks again, with help like this I’ll be joining your ranks soon!