You are Here: FAQ ->Scripting and Programming Languages->PHP->Article #19


WebHosting 5.0 This article is for 1&1 Linux WebHosting only.


Setting up phpMyAdmin for your MySQL database




PhpMyAdmin is already installed on all shared hosting and managed servers. You can access phpMyAdmin as described in How to access phpMyAdmin.

However, if you would like to install a different version of phpMyAdmin or need to give a developer access to a single database, you can.

Hint
If you have not already setup your database, you can do so easily. MySQL databases are included in Linux shared hosting and Managed server packages.


1. Login to the 1&1 Control Panel
2. Select your package if you have more then one package
3. Scroll down to 'Web Space & Access'
4. Next click on 'MySQL Administration' to display your "MySQL Database Set Up and Configuration" page.
5. In here you can create your MySQL Database by clicking the 'Set Up' button.


Tip
N.B. You may have to wait for up to 1 hour after creating your database before it is fully setup and ready to access.


To set up the phpMyAdmin tool on you website you must do the following steps:

* First download a .zip or .tar file.
* Extract the contents from the file, using WinZip etc.
* Edit the config.sample.inc.php file.
* Upload the files to a separate directory on your website.
* Password protect your directory.


The details for these processes are given bellow.


1. Go to the Internet site where you can download the phpMyAdmin tool.
2. You could either download the .tar or .zip file. (Its recommended that Windows users, download the .zip file).

You can download WinZip 8.0 by clicking here
3. Once you have downloaded the file unzip it using WinZip or a similar program of your choice. The files will then be placed into a directory called phpMyAdmin. Within this directory there is a file called config.sample.inc.php.
4. Open the file called config.sample.inc.php using Notepad or a similar text editor. Do not edit this file with MS Word or other Microsoft text editors. It looks something like the following:

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * phpMyAdmin sample configuration, you can use it as base for
 * manual configuration. For easier setup you can use setup/
 *
 * All directives are explained in Documentation.html and on phpMyAdmin
 * wiki <http://wiki.cihar.com>.
 *
 * @version $Id: config.sample.inc.php 11781 2008-11-06 05:29:28Z rajkissu $
 */

/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

/*
 * Servers configuration
 */
$i = 0;

/*
 * First server
 */
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';

/* rajk - for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';

/* User for advanced features */
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';
/* Advanced phpMyAdmin features */
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma_relation';
// $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma_column_info';
// $cfg['Servers'][$i]['history'] = 'pma_history';
// $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';

/*
 * End of servers configuration
 */

/*
 * Directories for saving/loading files from server
 */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';

?>

5. At the same time, go to your configuration page (via 1&1 Control Panel), click on 'Applications' -> 'MySQL administration'. All the information required can be found from there.
6. You will need to add a couple fields to this file for shared hosting where you
are connecting to only 1 or more databases and insert your information from the
mysql administration in the 1and1 control panel. The added fields are these:

Script : config.sample.inc.php when edited

$cfg['Servers'][$i]['user']          = 'dbo6548432';      // MySQL user
$cfg['Servers'][$i]['password']      = 'ufdhsbj5';          // MySQL password
(only needed
                                                    // with 'config' auth_type)
$cfg['Servers'][$i]['only_db']       = 'db6548432';          // If set to a
db-name, only
                                                    // this db is displayed
                                                    // at left frame
                                                    // It may also be an array
                                                    // of db-names


Thus your version should appear like this (below).  Remember to change 

this 

$cfg['Servers'][$i]['auth_type'] = 'cookie';

to 

$cfg['Servers'][$i]['auth_type'] = 'config';


<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * phpMyAdmin sample configuration, you can use it as base for
 * manual configuration. For easier setup you can use setup/
 *
 * All directives are explained in Documentation.html and on phpMyAdmin
 * wiki <http://wiki.cihar.com>.
 *
 * @version $Id: config.sample.inc.php 11781 2008-11-06 05:29:28Z rajkissu $
 */

/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

/*
 * Servers configuration
 */
$i = 0;

/*
 * First server
 */
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type']     = 'config';    // Authentication method
(config, http or cookie based)?
$cfg['Servers'][$i]['user']          = 'dbo6548432';      // MySQL user
$cfg['Servers'][$i]['password']      = 'ufdhsbj5';          // MySQL password
(only needed
                                                    // with 'config' auth_type)
$cfg['Servers'][$i]['only_db']       = 'db6548432';          // If set to a
db-name, only
                                                    // this db is displayed
                                                    // at left frame
                                                    // It may also be an array
                                                    // of db-names

/* Server parameters */
$cfg['Servers'][$i]['host'] = db31.oneandone.co.uk'; // MySQL hostname
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';

/* rajk - for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';

/* User for advanced features */
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';
/* Advanced phpMyAdmin features */
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma_relation';
// $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma_column_info';
// $cfg['Servers'][$i]['history'] = 'pma_history';
// $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';

/*
 * End of servers configuration
 */

/*
 * Directories for saving/loading files from server
 */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';

?>



You can leave everything else the way it is.
7. Once this change has been made, save the file (make sure that you save it with the name config.inc.php).
8. Upload the whole phpMyAdmin directory to your website.
9. Protect the directory by going to your "1&1 Control Panel" and in the 'Web Space & Access' Click on 'Protected Directories' and click on the 'Create' button to set up a new user, entering the user name, password, optionally a description, and then choose an existing directory from the list (phpMyadmin in this example), and click on 'Add'. Click on 'Ok' to save your settings and then on 'Go To Overview'.

Now to view the contents of your database go to www.yourdomain.com/phpMyAdmin.


For more information you could open the file called Documentation.html.


Print Article
How useful was this article?
(From 5 = Very Useful to 1 = Not useful at all):
1 2 3 4 5