PHP mysqli_change_user() 函数
PHP 教程
· 2019-01-27 16:57:05
实例
改变指定数据库连接的用户:
<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// 检查连接
if (mysqli_connect_errno($con))
{
echo "连接数据库失败: " . mysqli_connect_error();
}
// 切换数据库
mysqli_change_user($link, "my_user", "my_password", "my_test");
mysqli_close($con);
?>
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// 检查连接
if (mysqli_connect_errno($con))
{
echo "连接数据库失败: " . mysqli_connect_error();
}
// 切换数据库
mysqli_change_user($link, "my_user", "my_password", "my_test");
mysqli_close($con);
?>
定义和用法
mysqli_change_user() 函数改变指定数据库连接的用户,并设置当前数据库。
语法
mysqli_change_user(connection,username,password,dbname);
| 参数 | 描述 |
|---|---|
| connection | 必需。规定要使用的 MySQL 连接。 |
| username | 必需。规定 MySQL 用户名。 |
| password | 必需。规定 MySQL 密码。 |
| dbname | 必需。规定要改变的新数据库。 |
技术细节
| 返回值: | 如果成功则返回 TRUE,如果失败则返回 FALSE。 |
|---|---|
| PHP 版本: | 5+ |
点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html
Understanding Machine Learning
Shai Shalev-Shwartz、Shai Ben-David / Cambridge University Press / 2014 / USD 48.51
Machine learning is one of the fastest growing areas of computer science, with far-reaching applications. The aim of this textbook is to introduce machine learning, and the algorithmic paradigms it of......一起来看看 《Understanding Machine Learning》 这本书的介绍吧!