【问题标题】:Can't connect php to mysql server [duplicate]无法将php连接到mysql服务器[重复]
【发布时间】:2019-10-30 10:39:12
【问题描述】:

我是编程新手,我正在尝试使用 PHP 和 MYSQL 制作简单的注册/登录表单。但是当我打开网站时,有一个标志说

警告:mysqli_connect():服务器请求的身份验证方法未知客户端 [caching_sha2_password] 在 D:\xampp\htdocs\reg\server.php 第 10 行

警告:mysqli_connect(): (HY000/2054): The server requested authentication method unknown to the client in D:\xampp\htdocs\reg\server.php on line 10 登录

实际上我已经在谷歌上搜索过答案,但没有任何效果。这是来自错误的代码的第 10 行

    // connect to the database
$db = mysqli_connect('localhost', 'username', 'password', 'registration');

【问题讨论】:

    标签: php mysql


    【解决方案1】:

    您是否编辑了这一行并发送到这里?

    $db = mysqli_connect('localhost', 'username', 'password', 'registration');
    

    还是不加修改就发送了?

    您必须将“localhost”更改为您的数据库主机。用户名到您的数据库用户名,密码到您的数据库密码

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-10
    • 1970-01-01
    • 2019-05-13
    • 1970-01-01
    • 2015-05-10
    • 2012-11-03
    相关资源
    最近更新 更多