mysql_change_user

mysql_change_user — Change logged in user of the active connection

Syntax :

int mysql_change_user ( string $user , string $password [, string $database [, resource $link_identifier]] )

string user: Username to log in with string password: Password to use string database (optional): Default database to use for queries

Description :

mysql_change_user() changes the logged in user of the current active connection, or the connection given by the

optional link_identifier parameter. If a database is specified, this will be the current database after the

user has been changed. If the new user and password authorization fails, the current connected user stays

active.

Return Values: Returns TRUE on success or FALSE on failure.

Example

if (mysql_change_user($mysql, "user", "password", "new_database"))
{
   fprintf(stderr, "Failed to change user.  Error: %sn",
           mysql_error($mysql));
}
<?
function mysql_change_user($user, $password, $database = NULL, $con = NULL)
      {
        $con = mysql_resolve_link($con);
        return mysqli_change_user($con, $user, $password, $database);
       }
?>

Post Comment
Login to post comments