Tuesday, February 8, 2011

Installing phpMyadmin

The application must be installed within the wwws directory. Follow the steps below to install the phpMyAdmin program into your account on Webserve:

  1. Login to your Webserve account using an SSH command line client such as PuTTY. For further instructions on this step, see: How to use PuTTY.
  2. Move into your wwws directory by typing:
    webserve:myaccount> cd wwws
    If your account does not have a 'wwws' directory, refer to the Secure WWW Server document for information on creating this necessary directory.
  3. Install phpMyAdmin by typing the following:
    webserve:myaccount> install_phpmyadmin 

    An .htaccess file similar to the one below is automatically created in the phpmyadmin directory.
    AuthUserFile IUauth                                                             
    AuthGroupFile /dev/null
    AuthType Basic
    AuthName "IU Network ID"

    <Limit GET POST>
    require user myaccount
    You should not delete this .htaccess file. Removing it will make your MySQL database vulnerable to exploit.
    This .htaccess file currently restricts access to the IU Network ID 'myaccount' where 'myaccount' is the name of your Webserve account. You can edit this .htaccess file to add additional users to the line (separate each name with a space) :
    <Limit GET POST>                                                                            
    require user myaccount username1 username2
  4. You will need to edit the config.inc.php file before running phpMyAdmin. To move into the directory where this file is located, type: cd phpmyadmin As you edit the file, make sure lines do not wrap as a result of your edits. If you notice the line wraps as you enter information, correct the line so that it does not wrap.
    Below is the section of the config.inc.php file that you need to edit in order to establish a database connection. Replace port number, username, and password as shown below with the port number for your account and the username/password that you've granted privileges to when setting up your database.
    $cfg['Servers'][$i]['host'] = 'mysql.iu.edu'; // MySQL hostname
    $cfg['Servers'][$i]['port'] = 'port number'; // MySQL port
    $cfg['Servers'][$i]['extension'] = 'mysql';
    $cfg['Servers'][$i]['connect_type']= 'tcp';
    $cfg['Servers'][$i]['compress'] = false;
    $cfg['Servers'][$i]['auth_type'] = 'config';
    $cfg['Servers'][$i]['user'] = 'username'; // MySQL user
    $cfg['Servers'][$i]['password'] = 'password'; // MySQL password

    By default, the config.inc.php file has three blocks: one for connecting to the MySQL production server (mysql.iu.edu), one for connecting to the test MySQL server (mysql-test.iu.edu) and a blank one. The test server and blank ones are commented out so if you wish to establish connections beyond the first block, you will need to remove the "//" as these serve to "comment out" that portion of the file. Below is an example of the block with the comment tags still present.

    //$cfg['Servers'][$i]['host']        = 'mysql-test.iu.edu';//MySQL hostname
    //$cfg['Servers'][$i]['port'] = ''; // MySQL port
    //$cfg['Servers'][$i]['extension'] = 'mysql';
    //$cfg['Servers'][$i]['connect_type']= 'tcp';
    //$cfg['Servers'][$i]['compress'] = FALSE;
    //$cfg['Servers'][$i]['auth_type'] = 'config';
    //$cfg['Servers'][$i]['user'] = ''; // MySQL user
    //$cfg['Servers'][$i]['password'] = ''; // MySQL password