复制*user,数设置 const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long client_flag) Description MySQL(和PHP搭配之***组合)_real_connect() attempts to establish a connection to a MySQL(和PHP搭配之***组合) database engine running on host. MySQL(和PHP搭配之***组合)_real_connect() must complete successfully before you can execute any other API functions that require a valid MySQL(和PHP搭配之***组合) connection handle structure. The parameters are specified as follows: * The first parameter should be the address of an existing MySQL(和PHP搭配之***组合) structure. Before calling MySQL(和PHP搭配之***组合)_real_connect() you must call MySQL(和PHP搭配之***组合)_init() to initialize the MySQL(和PHP搭配之***组合) structure. You can change a lot of connect options with the MySQL(和PHP搭配之***组合)_options() call. See Section 17.2.3.47, “MySQL(和PHP搭配之***组合)_options()”. * The value of host may be either a hostname or an IP address. If host is NULL or the string "localhost", a connection to the local host is assumed. If the OS supports sockets (Unix) or named pipes (Windows), they are used instead of TCP/IP to connect to the server. * The user parameter contains the users MySQL(和PHP搭配之***组合) login ID. If user is NULL or the empty string "", the current user is assumed. Under Unix, this is the current login name. Under Windows ODBC, the current username must be specified explicitly. See Section 18.1.9.2, “Configuring a MyODBC DSN on Windows”. * The passwd parameter contains the password for user. If passwd is NULL, only entries in the user table for the user that have a blank (empty) password field are checked for a match. This allows the database administrator to set up the MySQL(和PHP搭配之***组合) privilege system in such a way that users get different privileges depending on whether they have specified a password. Note: Do not attempt to encrypt the password before calling MySQL(和PHP搭配之***组合)_real_connect(); password encryption is handled automatically by the client API. * db is the database name. If db is not NULL, the connection sets the default database to this value. * If port is not 0, the value is used as the port number for the TCP/IP connection. Note that the host parameter determines the type of the connection. * If unix_socket is not NULL, the string specifies the socket or named pipe that should be used. Note that the host parameter determines the type of the connection. * The value of client_flag is usually 0, but can be set to a combination of the following flags to enable certain features: 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.