You are here : phpmysqlimysqli_change_user

mysqli_change_user() - mysqli

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


Syntax

mysqli_change_user(connection,username,password,dbname);


Example

<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");

// 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($con, "my_user", "my_password", "my_test");

mysqli_close($con);
?> 


Output / Return Value


Limitations


Alternatives / See Also


Reference