0

当我在 Ubuntu 20.04 中使用 php 7.0 版并尝试打开:http://localhost/phpmyadmin/ - 然后:HTTP ERROR 500 appers。

当我尝试打开与数据库连接的任何其他页面时,会出现:

  • “消息:mysqli::real_connect():服务器请求客户端未知的身份验证方法 [caching_sha2_password]”
  • “mysqli::real_connect(): (HY000/2054): 服务器请求客户端未知的身份验证方法”

在此处输入图像描述 在此处 输入图像描述

当我将 php 版本更改为 7.4 时 - 一切正常(phpmyadnim 和页面)

我检查了 7.0 版的日志(tail /var/log/apache2/error.log),出现错误:

  • “PHP 解析错误:语法错误,意外的 'const' (T_CONST),预期变量 (T_VARIABLE) 在 /usr/share/php/PhpMyAdmin/MoTranslator/Translator.php 的第 58 行

在此处输入图像描述

我试过安装:

sudo apt-get install php-mbstring php7.0-mbstring php-gettext

但每次我这样做 - 我都会得到信息:“无法找到包 php-gettext”

在 php 版本 7.4 上一切正常。但我想使用 php 7.0 版。

我试过:

  • 再次删除并安装 phpmyadmin
  • 再次删除并安装php 7.0版
4

1 回答 1

0

当运行 7.1.16 之前的 PHP 版本或 7.2.4 之前的 PHP 7.2 时,请将 MySQL 8 Server 的默认密码插件设置为mysql_native_password,否则您将看到类似于未使用The server requested authentication method unknown to the client [caching_sha2_password]时的错误。caching_sha2_password

这是因为 MySQL 8 默认为caching_sha2_password,这是旧 PHP (mysqlnd) 版本无法识别的插件。相反,通过设置更改它default_authentication_plugin=mysql_native_passwordmy.cnfcaching_sha2_password plugin在未来的 PHP 版本中得到支持。

来源https://www.php.net/manual/en/mysqli.requirements.php

于 2020-10-22T12:49:20.897 回答