PHP mysqli_change_user() Function

Object oriented style

bool mysqli::change_user ( string $user , string $password , string $database )

Procedural style

bool mysqli_change_user ( mysqli $link , string $user , string $password , string $database )

Changes the user of the specified database connection and sets the current database.In order to successfully change users a valid username and password parameters must be provided and that user must have sufficient permissions to access the desired database. If for any reason authorization fails, the current user authentication will remain.

The mysqli_change_user() function changes the user of the specified database connection, and sets the current database.

Examples -

Example #1 mysqli::change_user() example

Object oriented style

Procedural style

ParameterDescription
linkProcedural style only: A link identifier returned by mysqli_connect() or mysqli_init()
userThe MySQL user name.
passwordThe MySQL password.
databaseThe database to change to.

Return Values

Returns TRUE on success or FALSE on failure.