Setup phpMyAdmin for Apache/MySQL

Table of contents

Updated: 20 April 2010

Introduction

There are a variety of methods available to interact with the MySQL database. The free shareware project, phpMyAdmin, is the most popular open-source project on the web.

This tutorial will go through the steps necessary to install, setup and configure phpMyAdmin for Apache 2.0.x with MySQL 4.0.x on a machine running Microsoft Windows.

As a guide, this tutorial will recommend the following installation folder:

  • MySQL: C:\www\phpMyAdmin\

Where you choose to install phpMyAdmin is up to you, just be aware to substitute appropriately when necessary.

Requirements

This tutorial assumes that Apache, PHP (4 or 5) and MySQL have all been installed and setup correctly. Read through the tutorials Install and Setup Apache/PHP and Install and Setup MySQL for more details.

This tutorial makes the following assumptions:

  • Apache is installed in the C:\www\Apache2\ directory
  • The localhost URL is referenced at http://localhost/

If your installation folder or localhost URL differ from either of these, be sure to substitute appropriately.

Download phpMyAdmin

Download the latest stable version of phpMyAdmin (2.6.x).

phpMyAdmin : zip package
http://www.phpmyadmin.net/home_page/downloads.php
Example: phpMyAdmin-2.6.2.zip (2,852 Kb)

Install phpMyAdmin

Unzip the phpMyAdmin zip package into the C:\www\ directory and rename the C:\www\phpMyAdmin-2.6.2\ directory to C:\www\phpMyAdmin\.

Configure phpMyAdmin

Note: The directory C:\www\phpMyAdmin\ will be referenced in the following section. If your installation folder differs from this, substitute appropriately.

Edit the config.inc.php file found in the C:\www\phpMyAdmin\ directory.

Define phpMyAdmin URI (config.inc.php: approx line 40)

$cfg['PmaAbsoluteUri'] = 'http://localhost/phpmyadmin/';

Note: Substitute appropriately if your localhost URL differs from this.

Define MySQL password (config.inc.php: approx line 85)

$cfg['Servers'][$i]['user'] = 'root'; // MySQL user
$cfg['Servers'][$i]['password'] = 'myPass'; // MySQL password (only needed

Note: Be sure to replace "myPass" with your MySQL root password.

Note: If you have not set (or have forgotten) the root password, please read our Install and setup MySQL tutorial, specifically the Reset the MySQL root password section.

Configure Apache for phpMyAdmin

Note: The directory C:\www\Apache2\ will be referenced in the following section. If your installation folder differs from this, substitute appropriately.

Apache now needs to know where to find the phpMyAdmin code. The easiest solution is to create a quick Alias for the phpMyAdmin directory.

Edit the httpd.conf file found in the C:\www\Apache2\conf\ directory.

Alias section (httpd.conf: approx line 480)

Alias /freeangle "D:/Web/freeangle"
Alias /phpmyadmin "C:/www/phpMyAdmin"

After restarting the Apache web server, we may now view the phpMyAdmin website through the URL address http://localhost/phpmyadmin/.

Note: Alias names are case-sensitive. For example, http://localhost/phpMyAdmin/ will not work unless "Alias /phpMyAdmin" is specified.

User comments

Add your comment

*
*