also
Alternatives to this function include:
mysqli_connect
PDO::__construct
Description
resource mysql_pconnect(
string server
=
=ini_get("mysql.default_host"),
string username
=
=ini_get("mysql.default_user"),
string password
=
=ini_get("mysql.default_password"),
int client_flags
=
=0);
Establishes a persistent connection to a MySQL server.
acts very much like
mysql_pconnect
First, when connecting, the function would first try to find a (persistent) link that's already open with
the same host, username and password. If one is found, an identifier for it will be returned instead of
opening a new connection.
Second, the connection to the SQL server will not be closed when the execution of the script ends.
Instead, the link will remain open for future use
mysql_pconnect).
This type of link is therefore called 'persistent'.
Parameters
server
username
password
client_flags
Return Values
Returns a MySQL persistent link identifier on success, or
Changelog
Version
5.5.0
4.3.0
Original MySQL API (Mysql)
MySQL: choosing an API
with
p:
with
PDO::ATTR_PERSISTENT
mysql_connect
The MySQL server. It can also include a port number. e.g.
"hostname:port" or a path to a local socket e.g. ":/path/to/socket" for
the localhost.
If the PHP directive
the default value is 'localhost:3306'
The username. Default value is the name of the user that owns the
server process.
The password. Default value is an empty password.
The
client_flags
of the following constants: 128 (enable
DATA LOCAL
MYSQL_CLIENT_COMPRESS
MYSQL_CLIENT_INTERACTIVE
2292
guide and
related FAQ
host prefix
with two major differences.
(mysql_close
will not close links established by
mysql.default_host
parameter can be a combination
handling),
MYSQL_CLIENT_SSL
,
MYSQL_CLIENT_IGNORE_SPACE
.
on failure.
FALSE
Description
This function will generate an
error.
Added the
client_flags
for more information.
as a driver option
is undefined (default), then
LOAD
,
E_DEPRECATED
parameter.
or
Need help?
Do you have a question about the 5.0 and is the answer not in the manual?
Questions and answers