Change the user of the specified database connection in PHP
Description
The following code shows how to change the user of the specified database connection.
Example
// w w w . jav a2 s .com
<?php
$con=mysqli_connect("localhost","root","","test");
// Check connection
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Reset all and select a new database
mysqli_change_user($link, "root", "", "test");
mysqli_close($con);
?>
The code above generates the following result.