【发布时间】:2019-05-22 23:14:48
【问题描述】:
我正在尝试使用 php 连接到 zend 服务器版本 7.2.10 中的 MySQL 版本 8.0.11 数据库,但我无法连接它
Warning: mysqli::__construct(): Unexpected server respose while doing caching_sha2 auth: 109 in C:\Program Files (x86)\Zend\Apache24\htdocs\connectdatabase.php on line 7
Warning: mysqli::__construct(): MySQL server has gone away in C:\Program Files (x86)\Zend\Apache24\htdocs\connectdatabase.php on line 7
Warning: mysqli::__construct(): (HY000/2006): MySQL server has gone away in C:\Program Files (x86)\Zend\Apache24\htdocs\connectdatabase.php on line 7
Connection failed :MySQL server has gone away
当我尝试运行我的代码时收到以下警告。
我已经搜索并尝试了ALTER USER 'username'@'hostname' IDENTIFIED WITH mysql_native_password BY "userpassword" 命令,但它对我不起作用
<?php
$servername = "localhost";
$username = "root";
$password = "hello";
$conn = new mysqli($servername,$username,$password);
if(mysqli_connect_error())
{
die("Connection failed :" . mysqli_connect_error());
}
echo "CONNECTED SUCCESSFULLY";
?>
【问题讨论】:
-
不工作,这就是我再次询问的原因
标签: php mysql zend-server