Databases Reference
In-Depth Information
In this section, we have to enter in
$cfg['Servers'][$i]['host']
, the hostname or
IP address of the MySQL server, for example,
mysql.mydomain.com
or
localhost
.
If this server is running on a non-standard port or socket, we fill in the correct values
in
$cfg['Servers'][$i]['port']
or
$cfg['Servers'][$i]['socket']
. See the
connect_type,
sockets,
and
port
section for more details about sockets.
The displayed server name inside phpMyAdmin's interface will be the one
entered in
'host'
unless we enter a non-blank value in the following parameter,
for example:
$cfg['Servers'][$i]['verbose'] = 'Test server';
This feature can thus be used to display a different server hostname as seen by the
users on the login panel and on the main page, although the real server name can be
seen as part of the user definition (for example,
root@localhost
) on the main page.
extension
The traditional-mechanism PHP uses to communicate with a MySQL server, as
available in PHP before version 5, is the
mysql
extension. This extension is still
available in PHP 5. However, a new extension called
mysqli
has been developed and
should be preferred for PHP 5, due to its improved performance and its support of
the full functionality of MySQL family 4.1.x. This extension is designed to work with
MySQL version 4.1.3 and higher. As phpMyAdmin supports both extensions, we can
choose either one for a particular server. We indicate the extension we want to use in
$cfg['Servers'][$i]['extension']
. The default value used is
mysqli
.
connect_type, socket, and port
Both the
mysql
and
mysqli
extensions automatically use a socket to connect to
MySQL if the server is on
localhost
. Consider the following configuration:
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysql';
The default value for
connect_type
is
tcp
. However, the extension will use a socket
because it concludes that this is more efficient as the
host
is
localhost
. So in this
case, we can use
tcp
or
socket
as the
connect_type
. To force a real TCP connection,
we can specify
127.0.0.1
instead of
localhost
in the
host
parameter. Because the
socket
parameter is empty, the extension will try the default socket. If this default
socket, as defined in
php.ini
, does not correspond to the real socket assigned to the
MySQL server, we have to put the socket name (for example,
/tmp/mysql.sock
) in
$cfg['Servers'][$i]['socket']
.
Search WWH ::
Custom Search