I record down the steps I installed phpMyAdmin 2.8.2 on Ubuntu 6.06 LTS (Dapper Drake) LAMP Server. They may be useful for my future reference. I can also pass this post to my friends who need to install phpMyAdmin on their web servers.
Please be reminded that the following steps are what I did to make phpMyAdmin installed and password protected on my web server. They are by no means perfect. There should be a number of different ways to complete the same task.
Step 1: Find a URL to download a phpMyAdmin-2.8.2.zip from here. I use http:// superb-west.dl.sourceforge.net /sourceforge /phpmyadmin /phpMyAdmin-2.8.2.zip. After that, type the following commands from the Ubuntu Server.
wget http://…/phpMyAdmin-2.8.2.zip
sudo unzip phpMyAdmin-2.8.2.zip
sudo cp –r phpMyAdmin-2.8.2 /var/www/
sudo mv /var/www/phpMyAdmin-2.8.2 /var/www/pma
sudo chown –R www-data /var/www/pma
Step 2: Create a file named config.inc.php by the following command. Type the content for it and press Ctrl-x then y then Enter to save the file.
sudo nano /var/www/pma/config.inc.php
<?php
$i = 0;
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '********';
?>
Step 3: Create a file named .htpasswd by the following command. Type the content for it and press Ctrl-x then y then Enter to save the file. Replace ***** with the appropriate passwords. The first one is the password for the root of the Ubuntu server. The second password is for entering the phpMyAdmin.
sudo htpasswd -cm /etc/apache2/.htpasswd mysqladmin
Password: *****
New password: *****
Re-type new password: *****
Adding password for user mysqladmin
Step 4: Create the .htaccess file. Type the content for it and press Ctrl-x then y then Enter to save the file.
sudo nano /var/www/pma/.htaccess
AuthUserFile /etc/apache2/.htpasswd
AuthName AccessToPMA
AuthType Basic
require user mysqladmin
Step 5: Configure the Apache2 by creating a file in the directory /etc/apache2/sites-enabled/.
sudo nano /etc/apache2/sites-enabled/pma
<Directory /var/www/pma>
AllowOverride AuthConfig
</Directory>
Step 6: Reload the Apache2 with the following command.
sudo /etc/init.d/apache2 force-reload