PhpMyAdmin Installation
In the simplest case, both phpMyAdmin and MySQL run on the same local computer (that is, Apache, PHP, MySQL, and the scripts for phpMyAdmin are all locally installed).
It is not much more complicated to install phpMyAdmin locally and thereby maintain a MySQL server that is running on another computer. The only difference is that config.inc.php must be set so that phpMyAdmin creates a connection to the external MySQL server. However, often, the problem arises that MySQL must be configured on the external computer in such a way that external administration is permitted. But for security reasons, ISPs in particular usually permit only local access to the server (that is, by localhost).
For the administration of a MySQL server located at an ISP, it is worthwhile to install phpMyAdmin there. As a rule, only the script files of phpMyAdmin need to be transported into a directory of the web server. All other conditions (Apache, PHP) are automatically fulfilled by most ISPs. Even access to MySQL is now not a problem, since phpMyAdmin is now, from the point of view of MySQL, being executed locally.
| CautionĀ |
It happens frequently that phpMyAdmin is installed in such a way that it is accessible to all users over a local network or even over the Internet who know or can guess the network address of the start page. To avoid giving complete MySQL access to just anyone, the access and phpMyAdmin script files must be password protected. Usually, a .htaccess file is used. Introductory information on dealing with such files can be found in |
Configuration of MySQL Access
The complete configuration of phpMyAdmin is accomplished in the file config.inc.php.In the simplest case, it suffices to set the following variables:
# configuration file config.inc.php . . .
// must contain the web address of the phpMyAdmin directory
$cfg['PmaAbsoluteUri'] = 'http://computer.name/phpmyadmin directory/'; . . .
$cfg['Servers'][$i]['host'] = 'computer.name‘;
// or 'localhost' . . .
$cfg['Servers'][$i]['auth_type'] = 'config';
// must be 'config' $cfg['Servers'][$i]['user'] = 'root‘;
// MySQL user $cfg['Servers'][$i]['password'] = 'xxxx‘;
// MySQL password …
If the MySQL server is running on the same computer as the web server that is executing the phpMyAdmin script files with PHP, then you give localhost as the computer name. Optionally, with $cfgServers[1][’port’] the TCP/IP port over which the link is established can be specified. That is necessary only if the default port 3306 is not the one to be used.
| CautionĀ |
The file config.inc.php contains the user name and password in plain text. That is always a security risk. Make sure that unauthorized access to this file, such as via anonymous FTP, is not possible. |
| RemarkĀ |
The extent of the possibilities for administration with phpMyAdmin depends, of course, on the MySQL access rights possessed by the MySQL user whose name phpMyAdmin has used at login (that is, $cfgServers[1] [’user’]= … ). Therefore, phpMyAdmin is not responsible for access protection, but rather the MySQL access system with the privilege database mysql |
Servicing Several MySQL Servers with phpMyAdmin
Host, user, and password entries for multiple MySQL servers are possible in config.inc.php. If you make such entries, then on the start page of MySQL there appears a listbox with the names of the computers whose MySQL servers can be managed. Selecting one of these names establishes a link to that server.
The variable $cfg[’ServerDefault’] determines the server that phpMyAdmin uses to establish a link at startup. If the variable is set to 0, then at startup phpMyAdmin initially sets no link, but merely presents a listbox with the selection of servers.
If you do not wish to have simply the computer name (array variable host) displayed in the listbox, then you can use $cfg[’Servers’][$i][’verbose’] to display a different character string.
Additional Configuration Possibilities
In addition to the MySQL access data in config.inc.php, you can also set various options. The following list describes only the most important of these, together with their associated variables:
-
$cfg[’Confirm’] = true/false: This variable specifies whether a confirmation query should be displayed before data are deleted (default: true).
-
$cfg[’MaxRows’] = n: Specifies how many data records should be displayed per page as the result of a query (default is 30).
-
$cfg[’ExecTimeLimit’] = n: Specifies how long the execution of the PHP code will be allowed to run (default is 300 seconds). The time is relevant primarily for time-intensive import/export commands.
-
$cfg[’ShowBlob’]=true/false: Specifies whether the contents of fields of type xxxBLOB are to be displayed (default: false).
-
$cfg[’ProtectBinary’] = false/’blob’/'all’: Specifies whether the contents of BLOB fields are to be write protected. By default (‘blob’), BLOBs cannot be changed. The prohibition against change to any table content (regardless of data type) is effected by ‘all’, while ‘false’ permits everything to be changed.
-
$cfg[’LeftWidth’]=n: Specifies the width of the left column of the main window (by default, 150 pixels). In this column are displayed the listbox for database selection and the list of tables in the current database.
Tags: mysql client, phpmyadmin