<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/mysqli.setup.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'mysqli.requirements.php',
    1 => '需求',
    2 => '需求',
  ),
  'up' => 
  array (
    0 => 'mysqli.setup.php',
    1 => '安装/配置',
  ),
  'prev' => 
  array (
    0 => 'mysqli.setup.php',
    1 => '安装/配置',
  ),
  'next' => 
  array (
    0 => 'mysqli.installation.php',
    1 => '安装',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/mysqli/setup.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mysqli.requirements" class="section">
  <h2 class="title">需求</h2>
  <p class="para">
   为了使这些函数可用，必须编译支持 mysqli 扩展的 PHP。
  </p>

  <p class="para">
    <strong>MySQL 8</strong>
  </p>
  
  <p class="para">
   当运行 PHP 7.1.16 之前的版本或者 PHP 7.2.4 之前的 PHP 7.2 版本时，需要将 MySQL 8 服务器的默认密码插件设置为
   <em>mysql_native_password</em>。否则在未使用 <em>caching_sha2_password</em>
   时，也会看到类似这样的错误 <em>The server requested authentication method unknown to the client
   [caching_sha2_password]</em>。
  </p>
  <p class="para">
   这是因为 MySQL 8 默认使用 caching_sha2_password，这是旧版 PHP (mysqlnd) 版本无法识别的插件。然而，可以在
   <var class="filename">my.cnf</var> 中设置 <code class="literal">default_authentication_plugin=mysql_native_password</code>
   来变更它。从 PHP 7.4.4 开始，完全支持 <em>caching_sha2_password</em>
   插件。对于旧版本，<a href="book.mysql-xdevapi.php" class="link">mysql_xdevapi</a> 扩展支持。
  </p>
 </div><?php manual_footer($setup); ?>