MySQL Native Driver (
Mysqlnd
)
2530
The default buffer size is 2048 bytes in PHP 5.3.0. In later versions
the default is 4096 bytes. The default can changed either through
the
php.ini
setting
mysqlnd.net_cmd_buffer_size
or using
mysqli_options(MYSQLI_OPT_NET_CMD_BUFFER_SIZE, int
size)
.
It is recommended that the buffer size be set to no less than
4096 bytes because
mysqlnd
also uses it when reading certain
communication packet from MySQL. In PHP 5.3.0,
mysqlnd
will
not grow the buffer if MySQL sends a packet that is larger than the
current size of the buffer. As a consequence,
mysqlnd
is unable
to decode the packet and the client application will get an error.
There are only two situations when the packet can be larger than
the 2048 bytes default of
mysqlnd.net_cmd_buffer_size
in PHP 5.3.0: the packet transports a very long error message,
or the packet holds column meta data from
COM_LIST_FIELD
(
mysql_list_fields()
and the meta data come from a string
column with a very long default value (>1900 bytes).
As of PHP 5.3.2 mysqlnd does not allow setting buffers smaller than
4096 bytes.
The value can also be set using
mysqli_options(link,
MYSQLI_OPT_NET_CMD_BUFFER_SIZE, size)
.
mysqlnd.net_read_buffer_size
long
Maximum read chunk size in bytes when reading the body
of a MySQL command packet. The MySQL client server
protocol encapsulates all its commands in packets. The
packets consist of a small header and a body with the actual
payload. The size of the body is encoded in the header.
mysqlnd
reads the body in chunks of
MIN(header.size,
mysqlnd.net_read_buffer_size)
bytes. If a packet body is
larger than
mysqlnd.net_read_buffer_size
bytes,
mysqlnd
has to call
read()
multiple times.
The value can also be set using
mysqli_options(link,
MYSQLI_OPT_NET_READ_BUFFER_SIZE, size)
.
mysqlnd.sha256_server_public_key
string
SHA-256 Authentication Plugin related. File with the MySQL server
public RSA key.
Clients can either omit setting a public RSA key, specify the key
through this PHP configuration setting or set the key at runtime
using
mysqli_options
. If not public RSA key file is given by
the client, then the key will be exchanged as part of the standard
SHA-256 Authentication Plugin authentication procedure.
20.7.5.4. Persistent Connections
Copyright 1997-2012 the PHP Documentation Group. [2230]
Using Persistent Connections
If
mysqli
is used with
mysqlnd
, when a persistent connection is created it generates a
COM_CHANGE_USER
(
mysql_change_user()
) call on the server. This ensures that re-authentication
of the connection takes place.
As there is some overhead associated with the
COM_CHANGE_USER
call, it is possible to switch this off
at compile time. Reusing a persistent connection will then generate a
COM_PING
(
mysql_ping
) call to
simply test the connection is reusable.
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...