Tips_sql   >   Mysql   >   phpMyAdmin

phpMyAdmin

is a widely used GUI administration tool for MySQL. Being browser based you don't need any client side software to use it and depending on how you set it up you could also access if from anywhere on the internet.

Installing PHP and phpMyAdmin on my MacBook Pro is where I spent many hours. Hopefully the tips in this section will save you some grief. Once phpMyAdmin is set up and running it works great.

Installing PHP on Mac OS X

Before you do anything, check to see if PHP is installed and enabled on your Mac as follows:

  1. Turn on Personal Web Sharing in the System Preferences under Sharing.
  2. Go to Library/WebServer/Documents and create a file called phpinfo.php using a text editor.
  3. Enter the following text in the file and save the file.

    <?php phpinfo() ?>

  4. From your web browser enter the URL localhost/phpinfo.php
  5. If PHP is enabled, you will get a page with all kinds of info about PHP displayed in your browser. If PHP not enabled you will just get the text of your file displayed in the browser.

If you need to enable PHP do the following from the command line:

  1. Go to the httpd directory

    cd /etc/httpd
  2. Open the httpd configuration file as super user using pico or the text editor of your choice. (My preference is BBedit). You will need to enter the root password for your computer.

    sudo pico -w httpd.conf
  3. In the config file you will need to find and uncomment the following lines by deleting the # character at the beginning of the line.

    For Mac OS X 10.5

    #LoadModule php5_module



    For Mac OS X 10.4

    #LoadModule php4_module
    #AddModule mod_php4.c

  4. Ctrl+X to exit pico.
  5. Stop and restart Personal Web Sharing in the System Preferences.
  6. Try the localhost/phpinfo.php in your web browser again. Be sure to reload the page.
  7. If that doesn't work Google around for tips from other developers.
Once you have PHP working you are ready to install phpMyAdmin.

Installing PHP on WinXP

On WinXP you will need to install/enable web server software on their computer. You can only run your computer as a web server if you have WinXP Pro. Afer installing and setting up your computer as a web server type in http://localhost/ in your browser to test whether or not it is working.

Once you have your WinXP computer working as a web server you are ready to install PHP.

Google for Download PHP for WinXP and then download and install the latest version of PHP following the directions provided.

Installing phpMyAdmin on Mac OS X

is easy to install, but I had a tough time getting the config file sorted out so that it would work on my MacBook Pro.

  1. Download phpMyAdmin from www.phpmyadmin.net. At the time of writing this I could not get the 2.8 version to work property. There isn't a package installer for Mac OS X so I just download the zip version. The download is small.
  2. Drag a copy of the downloaded and unzipped folder into your /Library/WebServer/Documents folder.
  3. Rename the folder to pma to save you some typing in your web browser.
  4. The documentation talks about a config.inc.php file which you are supposed to modify rather than the config.default.php file. (There is a warning at the top of the config.default.php file.) In my case no such file existed. Eventually I created the file myself directly inside the pma folder and found that the following text in the file did the trick.


    $cfg['blowfish_secret'] = 'ae85mh04wq23'; // Enter a random string to be used for blowfish encryption

    // Server(s) configuration
    $i = 0;
    $i++;
    $cfg['Servers'][$i]['host'] = '127.0.0.1'; // 'localhost' did NOT work!
    $cfg['Servers'][$i]['connect_type'] = 'socket'; // 'tcp' did NOT work!

    $cfg['Servers'][$i]['auth_type'] = 'cookie'; // Using cookies is easiest and safest setup.
    $cfg['Servers'][$i]['user'] = ''; // MySQL user - empty for cookies
    $cfg['Servers'][$i]['password'] = ''; // MySQL password - empty for cookies

    ?>

  5. Go to localhost/pma in your web browser. All going well you will be prompted to enter a user name and password. You can either enter the root user name and password or the DBADMIN user name and password if you created one.
  6. Click the Logon button. All going well you will be presented with a Welcome to phpMyAdmin page.