MySQLi - Change User

语法

change_user ( string $user , string $password , string $database )

定义和用法

用于打开或关闭自动提交数据库修改操作。

示例

Try out following example −

<?php
   $servername = "localhost:3306";
   $username = "root";
   $password = "";
   $dbname = "TUTORIALS";
   $conn = new mysqli($servername, $username, $password, $dbname);
   
   if ($conn->connect_error) {
      die("Connection failed: " . $conn->connect_error);
   } 
   echo"Database connected 
";
   mysqli_change_user($conn, "user", "pass", "my_NewUser"); 
   
   mysqli_close($conn);
?>

上述代码的示例输出应该是这样的 -

Database connected

mysqli_useful_functions.html