Among the many functions in the MYSQL database, there are two functions used for connection: MysQL-connect () and MySQL _ pconnect (). Syntax: int MySQL-connect (string [hostname] (: [Port, string [username], string [password]) int MySQL _ pconnect (string [hostname] (: [Port, string [username], string [password]) after the connection is successful, both functions return a connection number. If the connection fails, return a false value. In the parameter, the host name (hostname) can contain the port number of the database service. The default port number is usually used. If all parameters are specified, the default host name is "localhost". The username is the database administrator. The default host name is "root" and the Password is blank. When you use MysQL connect () to establish a connection, the established connection is automatically closed after the database operation is completed, unless the connection has been forcibly closed by MySQL-close () before this. MysQL-pconnect () automatically checks whether a connection is established using the same host name, user name, and password. If yes, the connection ID is used directly. In addition, using MySQL-pconnect () is a stable and persistent connection that will not be stopped because of the database operation. And will not be terminated by the function MySQL_commect. Program example: <? Php $ connect = MySQL_connect ('localhost', 'username', 'Password'); echo "$ connect";?> The program running result is: (1 ). This indicates that the program has been connected to the database. Source: Jingan network http://host.zzidc.com/reprinted note