设置

所有可配置的数据均位于 phpMyAdmin 的根目录下的 config.inc.php 文件中。若该文件不存在,请参考 安装 一节来创建它。该文件只需包含你想从其相应的默认值中改变的参数。

参见

示例 为示例配置

如果文件中缺少指令,则只需在文件中添加另一行。该文件用于覆盖默认值;如果您想使用默认值,则无需在此处添加行。

与设计相关的设置(如颜色)是通过 themes/主题名/scss/_variables.scss 定义的。你可以创建 config.footer.inc.phpconfig.header.inc.php 文件分别向你的网站的每个页面的页眉和页脚添加特定代码。

注解

有些版本(如:Debian 或 Ubuntu)将 config.inc.php 放在 /etc/phpmyadmin 中而不是 phpMyAdmin 源代码中。

基本设置

$cfg['PmaAbsoluteUri']
类型:文本
默认值:''

在 4.6.5 版更改: phpMyAdmin 4.6.0 - 4.6.4中没有此设置。

设置您 phpMyAdmin 安装文件夹的完整 URL (包含路径)。如:https://www.example.net/path_to_your_phpMyAdmin_directory/。请注意大多数网站服务器的 URL 是区分大小写的(甚至在Windows上)。别忘了最后的斜杠。

自 2.3.0 起,我们建议尝试将该设置留空。大多数情况下 phpMyAdmin 能正确地自动识别。端口转发或复杂反向代理设置的用户可能需要设置此项。

通过浏览一张表、编辑并保存一条记录可以测试出自动识别是否有问题。若有问题 phpMyAdmin 会提示出错。若您收到了必须设置或自动识别失败的错误,请在我们的缺陷追踪器上向我们提交一份缺陷报告以便我们能改进相关代码。

$cfg['PmaNoRelation_DisableWarning']
类型:布尔值
默认值:false

自 2.3.0 起 phpMyAdmin 提供了一系列关于主/外表的功能 (参见 $cfg['Servers'][$i]['pmadb'])。

如果你尝试使用这些功能但无法正常使用,请在你想使用该功能的数据库中打开:guilabel:结构 页。你会看到一个可以告诉你为什么这些功能无法使用的链接。

若您不想使用那些功能,将该项设为 true 即可隐藏提示信息。

$cfg['AuthLog']
类型:文本
默认值:'auto'

4.8.0 新版功能: 自phpMyAdmin 4.8.0起支持此功能。

配置认证记录目的地。失败(或全部,取决于 $cfg['AuthLogSuccess'])认证尝试将记录在这个目录下面:

auto
让phpMyAdmin自动选择``syslog``和``php``。
syslog
使用syslog及AUTH工具进行日志记录,在大多数系统上最后会输出到 /var/log/auth.log
php
记录到PHP错误日志。
sapi
记录到PHP SAPI日志记录。
/path/to/file
任何其他值都被视为文件名,并在那里写入日志条目。

注解

记录到文件时,请确保为Web服务器用户正确设置其权限,设置应严格匹配如下描述的说明: $cfg['TempDir']:

$cfg['AuthLogSuccess']
类型:布尔值
默认值:false

4.8.0 新版功能: 自phpMyAdmin 4.8.0起支持此功能。

是否将成功的身份验证尝试记录到 $cfg['AuthLog']

$cfg['SuhosinDisableWarning']
类型:布尔值
默认值:false

若检测到 Suhosin 将在首页中显示警告。

将该项设为 true 即可隐藏提示信息。

$cfg['LoginCookieValidityDisableWarning']
类型:布尔值
默认值:false

如果PHP参数session.gc_maxlifetime低于phpMyAdmin中配置的cookie有效性,则主页上会显示警告。

将该项设为 true 即可隐藏提示信息。

$cfg['ServerLibraryDifference_DisableWarning']
类型:布尔值
默认值:false

4.7.0 版后已移除: 此设置已删除,因为警告也已删除。

若服务器与 MySQL 库版本不同将在首页中显示警告。

将该项设为 true 即可隐藏提示信息。

$cfg['ReservedWordDisableWarning']
类型:布尔值
默认值:false

若表的一个或多个字段名为 MySQL 保留字时将在该表的结构页中显示警告。

将该项设为 true 即可关闭该警告。

$cfg['TranslationWarningThreshold']
类型:整数
默认值:80

显示翻译不完整警告的阈值。

$cfg['SendErrorReports']
类型:文本
默认值:'ask'

有效值有:

  • ask
  • always
  • 从不

设置JavaScript错误报告的默认行为。

每当在JavaScript执行中检测到错误时,如果用户同意,可以向phpMyAdmin团队发送错误报告。

每次出现新的错误报告时,默认设置 'ask' 都会询问用户。但是你可以将这个参数设置为 'always' 来发送错误报告而不要求确认,或者你可以将它设置为 'never' 永不发送错误报告。

该指令在配置文件和用户首选项中均可用。如果负责多用户安装的人员更喜欢为所有用户禁用此功能,则应设置值为 'never',并且 $cfg['UserprefsDisallow'] 指令应该在其中一个数组值中包含``’SendErrorReports’`` 。

$cfg['ConsoleEnterExecutes']
类型:布尔值
默认值:false

将其设置为``true``允许用户通过按Enter而不是Ctrl + Enter来执行查询。按Shift + Enter可以插入新行。

可以使用控制台的设置界面临时更改控制台的行为。

$cfg['AllowThirdPartyFraming']
类型:布尔值|文本
默认值:false

将该项设为 true 将允许 phpMyAdmin 被嵌入到框架中,同时是一个潜在的安全隐患并将导致跨框架脚本攻击或点击劫持成为可能。将此设置为’sameorigin’可防止phpMyAdmin包含在框架中的其他文档中,除非该文档属于同一域名。

服务器连接设置

$cfg['Servers']
类型:数组
默认值:一个服务器数组,下面列出了设置

自 1.4.2 起,phpMyAdmin 支持管理多个 MySQL 服务器。因此使用了 $cfg['Servers'] 数组来保存不同服务器的登录信息。第一个 $cfg['Servers'][$i]['host'] 表示第一个服务器的主机名,第二个 $cfg['Servers'][$i]['host'] 表示第二个服务器的主机名,以此类推。在 libraries/config.default.php 中,只有一节服务器的设置,您可以根据需要将其多次复制到 config.inc.php 中,完全复制或仅复制需要的部分(您要修改的部分)都行。

注解

$cfg['Servers'] 数组由 $cfg[‘Servers’][1] 开始。请勿使用 $cfg[‘Servers’][0]。若您需要多个服务器,请复制(包含自增的 $i)多次。您不需要设置所有服务器数组,设置您要修改的值即可。

$cfg['Servers'][$i]['host']
类型:文本
默认值:'localhost'

您第 $i 个 MySQL 服务器的主机名或 IP 地址。如 localhost

有效值有:

  • 主机名,如:'localhost''mydb.example.org'
  • IP 地址,如:'127.0.0.1''192.168.10.1'
  • IPv6 地址, 如 2001:cdba:0000:0000:0000:0000:3257:9652
  • 点 - '.',即 Windows 系统上的命名管道
  • 空 - '',禁用该服务器

注解

主机名``localhost``由MySQL专门处理,它使用基于套接字的连接协议。要使用TCP/IP网络,请使用IP地址或主机名,例如``127.0.0.1``或``db.example.com``。您可以使用 $cfg['Servers'][$i]['socket'] 配置套接字的路径。

$cfg['Servers'][$i]['port']
类型:文本
默认值:''

您第 $i 个 MySQL 服务器的端口号。默认(留空)为 3306。

注解

若您使用 localhost 作为主机名,MySQL 将忽略端口号而使用套接字进行连接,所以若您想连接到非默认端口,请在 $cfg['Servers'][$i]['host'] 中填写 127.0.0.1 或真正的主机名。

$cfg['Servers'][$i]['socket']
类型:文本
默认值:''

要使用的套接字路径。留空为默认。要确定正确的套接字,请查看您的 MySQL 设置,或使用 MySQL 命令行客户端执行 status 命令。该命令将会显示出所使用的套接字。

注解

它仅当 $cfg['Servers'][$i]['host'] 设置为 localhost 的时候会生效。

$cfg['Servers'][$i]['ssl']
类型:布尔值
默认值:false

是否为phpMyAdmin和MySQL服务器之间的连接启用SSL以保护连接。

当使用``’mysql’扩展名时,其余的’ssl…’`` 配置选项都不适用。

我们强烈建议您在使用该项的同时使用``’mysqli’`` 扩展。

$cfg['Servers'][$i]['ssl_key']
类型:文本
默认值:

通过 SSL 连接到 MySQL 服务器时所用的客户端密钥文件路径。这用于向服务器验证客户端。

如:

$cfg['Servers'][$i]['ssl_key'] = '/etc/mysql/server-key.pem';
$cfg['Servers'][$i]['ssl_cert']
类型:文本
默认值:

通过 SSL 连接到 MySQL 服务器时所用的客户端证书文件路径。这用于向服务器验证客户端。

$cfg['Servers'][$i]['ssl_ca']
类型:文本
默认值:

通过 SSL 连接到 MySQL 服务器时所用的证书颁发机构文件路径。

$cfg['Servers'][$i]['ssl_ca_path']
类型:文本
默认值:

存放有 PEM 格式的受信任 SSL 证书颁发机构证书的文件夹。

$cfg['Servers'][$i]['ssl_ciphers']
类型:文本
默认值:

通过 SSL 连接到 MySQL 服务器时可以使用的加密算法列表。

$cfg['Servers'][$i]['ssl_verify']
类型:布尔值
默认值:true

4.6.0 新版功能: 自phpMyAdmin 4.6.0起支持此功能。

如果您的PHP安装使用MySQL本机驱动程序(mysqlnd),您的MySQL服务器是5.6或更高版本,并且您的SSL证书是自签名的,那么您的SSL连接可能会因验证而失败。将其设置为``false``将禁用验证检查。

从PHP 5.6.0开始,它还验证服务器名称是否与其证书的CN匹配。目前无法在不禁用完整SSL验证的情况下禁用此检查。

警告

禁用证书验证会失去使用SSL的意义。这将使连接易受中间人攻击。

注解

此标志仅适用于PHP 5.6.16或更高版本。

$cfg['Servers'][$i]['connect_type']
类型:文本
默认值:'tcp'

4.7.0 版后已移除: 从4.7.0开始不再使用此设置,因为MySQL根据主机决定连接类型,因此可能会导致意外结果。请相应地设置 $cfg['Servers'][$i]['host'] 选项。

设置如何连接到 MySQL 服务器。您可以选择 'socket''tcp'。默认为 tcp,因为几乎所有的 MySQL 服务器都支持,而有些平台是不支持套接字的。要使用套接字方式连接,您的 MySQL 服务器必须和网站服务器在同一台服务器上。

$cfg['Servers'][$i]['compress']
类型:布尔值
默认值:false

设置是否使用压缩协议连接到 MySQL 服务器(试验性的)。

$cfg['Servers'][$i]['controlhost']
类型:文本
默认值:''

设置使用一个其它的主机来保存高级功能的数据。

$cfg['Servers'][$i]['controlport']
类型:文本
默认值:''

设置通过一个其它的端口来连接到保存高级功能数据的主机。

$cfg['Servers'][$i]['controluser']
类型:文本
默认值:''
$cfg['Servers'][$i]['controlpass']
类型:文本
默认值:''

这个特殊账户用于访问 phpMyAdmin配置存储。在单用户案例中不需要它,但如果共享phpMyAdmin,建议只向该用户授予对 phpMyAdmin配置存储 的访问权限,并配置phpMyAdmin使用它。然后,所有用户都可以使用这些功能,而无需直接访问 phpMyAdmin配置存储

在 2.2.5 版更改: 它们叫做``stduser``和``stdpass``

$cfg['Servers'][$i]['control_*']
类型:mixed

4.7.0 新版功能.

您可以使用前缀为``control_``的配置更改控件链接的任何MySQL连接设置(用于访问 phpMyAdmin配置存储)。

这可以用于更改控件连接的任何方面,默认情况下使用与用户相同的参数。

例如,您可以为控件连接配置SSL:

// Enable SSL
$cfg['Servers'][$i]['control_ssl'] = true;
// Client secret key
$cfg['Servers'][$i]['control_ssl_key'] = '../client-key.pem';
// Client certificate
$cfg['Servers'][$i]['control_ssl_cert'] = '../client-cert.pem';
// Server certification authority
$cfg['Servers'][$i]['control_ssl_ca'] = '../server-ca.pem';
$cfg['Servers'][$i]['auth_type']
类型:文本
默认值:'cookie'

设置该服务器是使用 config 还是 cookie 还是 HTTP 还是 signon 认证方式。

  • ‘config’ 认证方式($auth_type = 'config')是最原始的方法:将用户名和密码保存在 config.inc.php 中。
  • ‘cookie’认证方式($auth_type = 'cookie')将借助cookie允许您使用任何有效的 MySQL 用户登录。
  • ‘http’ 基本认证方式将允许您通过http认证使用任何有效的 MySQL 用户登录。
  • ‘signon’ 认证方式($auth_type = 'signon')将允许您从准备好的PHP会话数据或使用提供的PHP脚本登录。
$cfg['Servers'][$i]['auth_http_realm']
类型:文本
默认值:''

在 auth_type = http 时,您可以通过该项设置一个自定义的 HTTP 基本认证提示信息给用户。若不设置,将使用“phpMyAdmin ”加上 $cfg['Servers'][$i]['verbose']$cfg['Servers'][$i]['host']

$cfg['Servers'][$i]['auth_swekey_config']
类型:文本
默认值:''

3.0.0.0 新版功能: 此设置名为“$cfg[‘Servers’][$i][‘auth_feebee_config’]”,并在’3.0.0.0’发布之前重命名。

4.6.4 版后已移除: 此设置已被删除,因为他们的服务器不再工作,并且无法正常工作。

4.0.10.17 版后已移除: 此设置已在维护版本中删除,因为他们的服务器不再工作,并且无法正常工作。

包含用于硬件身份验证的密钥ID和登录名的文件名。留空可停用此功能。

$cfg['Servers'][$i]['user']
类型:文本
默认值:'root'
$cfg['Servers'][$i]['password']
类型:文本
默认值:''

使用 $cfg['Servers'][$i]['auth_type'] 时设置为’config’,这是phpMyAdmin用来连接MySQL服务器的用户/密码对。在 HTTP 或cookie身份验证的时候不需要此用户/密码对,并且应为空。

$cfg['Servers'][$i]['nopassword']
类型:布尔值
默认值:false

4.7.0 版后已移除: 此设置已删除,因为它可能会产生意外结果。

设置使用密码登录失败时是否允许尝试使用空密码登录。可与 http 认证同时使用,或通过其他方式完成认证使得 phpMyAdmin 取得用户名及空密码来连接到 MySQL 。然而总是会先尝试使用密码登录的。

注解

It is possible to allow logging in with no password with the $cfg['Servers'][$i]['AllowNoPassword'] directive.

$cfg['Servers'][$i]['only_db']
类型:字符串或数组
默认值:''

设置一个 (或一组) 数据库名,用户只能看到这些数据库。自 phpMyAdmin 2.2.1 起,数据库名可以包含 MySQL 通配符 (“_” 和 “%”): 如果你想使用这些字符本身,请转义它们 (即: 要使用 'my\_db' 而不是 'my_db')。

此设置可有效降低服务器的负载,因为不需要向 MySQL 发送构建可用数据库列表的请求。但**它并不能取代 MySQL 数据库服务器的权限规则**。这仅意味着这些数据库被显示出来而已,而**不是说没有显示出来的数据库都不能用。**

使用多个数据库的示例:

$cfg['Servers'][$i]['only_db'] = ['db1', 'db2'];

在 4.0.0 版更改: 以前的版本允许通过此指令指定数据库名称的显示顺序。

$cfg['Servers'][$i]['hide_db']
类型:文本
默认值:''

对非特权用户隐藏数据库的正则表达式。 这仅仅将数据库从列表中隐藏,用户仍然可以直接访问 (如通过 SQL 查询)。要彻底限制访问,请使用 MySQL 权限系统。例如,要隐藏所有开头字母是a的数据库,使用

$cfg['Servers'][$i]['hide_db'] = '^a';

同时隐藏db1和db2,使用

$cfg['Servers'][$i]['hide_db'] = '^(db1|db2)$';

可以在 PHP 手册的 PCRE正则语法<https://secure.php.net/manual/zh/reference.pcre.pattern.syntax.php> 一节中找到更多关于正则表达式的信息。

$cfg['Servers'][$i]['verbose']
类型:文本
默认值:''

仅在通过 phpMyAdmin 管理多个服务器时有用。主页的下拉菜单中将用此值代替主机名。如果你想只显示系统中部分数据库时也有用,如,使用 HTTP 认证时,所有非 ASCII 字符都将被删除。

$cfg['Servers'][$i]['extension']
类型:文本
默认值:'mysqli'

4.2.0 版后已移除: 此设置已删除。仅当``mysqli``扩展名不可用时才会使用``mysql``扩展名。从5.0.0开始,只能使用``mysqli``扩展名。

要使用的PHP MySQL扩展(mysql``或``mysqli)。

建议在所有安装中使用``mysqli``。

$cfg['Servers'][$i]['pmadb']
类型:文本
默认值:''

包含 phpMyAdmin 高级功能数据的数据库名。

参见 phpMyAdmin配置存储 一节了解其好处以及如何快速创建该数据库和需要的数据表。

如果此 phpMyAdmin 只有你自己使用,你可以用你当前的数据库来保存这些特殊的数据表,这种情况下,你可以在 $cfg['Servers'][$i]['pmadb'] 中填写当前数据库的名字。若此 phpMyAdmin 作为多用户使用,请设为包含 phpMyAdmin 高级功能数据表的专用数据库。

$cfg['Servers'][$i]['bookmarktable']
类型:字符串或“false”
默认值:''

2.2.0 新版功能.

自 2.2.0 起 phpMyAdmin 允许用户将查询加入书签。你可以将经常要执行的语句加入书签。要允许使用此功能:

可以通过将配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['relation']
类型:字符串或“false”
默认值:''

2.2.4 新版功能.

自 2.2.4 起你可以在 ‘relation’ 表的支持下定义一张表中的一个字段与另一张表的关系 (外键)。目前 phpMyAdmin 将它用于:

字段值可以是数字或者字符。

要启用此功能:

  • 设置好 $cfg['Servers'][$i]['pmadb'] 和 phpMyAdmin 配置存储
  • $cfg['Servers'][$i]['relation'] 中设置要使用的数据表名
  • 现在以普通用户登录到 phpMyAdmin 并打开每一张你想要使用这个功能的数据表,点击:guilabel:结构/关系查看/ 并设置外键字段。

可以通过将配置设置为``false``来禁用此功能。

注解

请注意在当前版本中 master_db 必须和 foreign_db 一致。这两个字段是为后期跨数据库关系开发预留的。

$cfg['Servers'][$i]['table_info']
类型:字符串或“false”
默认值:''

2.3.0 新版功能.

自 2.3.0 起你可以在一个特殊的 ‘table_info’ 表的支持下设置当鼠标移到对应字段时用气泡提示显示出来的相应内容。此配置变量将保留此特殊表的名称。要允许使用此功能:

可以通过将配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['table_coords']
类型:字符串或“false”
默认值:''

设计器功能可以保存您的页面布局;通过在展开的设计器菜单中按“保存页面”或“将页面另存为”按钮,您可以自定义布局并在下次使用设计器时加载它。该布局存储在此表中。此外,使用PDF关系导出功能也需要此表,请参阅 $cfg['Servers'][$i]['pdf_pages'] 以获取更多详细信息。

$cfg['Servers'][$i]['pdf_pages']
类型:字符串或“false”
默认值:''

2.3.0 新版功能.

自 2.3.0 版本起你可以用 phpMyAdmin 创建 PDF 页面来显示各数据表之间的关系。要实现这个功能需要两张数据表, “pdf_pages” (保存可用 PDF 页的信息) 和 “table_coords” (保存每张表在 PDF 大纲输出中的坐标)。您必须使用“关系”功能。

要启用此功能:

可以通过将任一配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['designer_coords']
类型:文本
默认值:''

2.10.0 新版功能: 自 2.10.0 起可以通过设计器可视化地管理关系。

4.3.0 版后已移除: 此设置已被删除,设计器表格定位数据现在存储到 $cfg['Servers'][$i]['table_coords']

注解

现在你可以从你的 phpMyAdmin 配置存储数据库中删除`pma__designer_coords`表,并从你的配置文件中删除 :config:option:`$cfg[‘Servers’][$i][‘designer_coords’]’。

$cfg['Servers'][$i]['column_info']
类型:字符串或“false”
默认值:''

2.3.0 新版功能.

这部分需要更新内容! 自 2.3.0 起您可以存储注释来描述每个表的每个列。然后这些将显示在“打印视图”上。

从版本2.5.0开始,注释因此在表属性页面和表浏览视图中使用,在列名称(属性页面)上方显示为工具提示或嵌入在浏览视图中的表头中。它们也可以显示在表转储中。请稍后查看相关的配置指令。

自 2.5.0 起 MIME 类型转换系统同样基于下列数据表结构。详情请参见 转换。要想使用 MIME 类型转换系统,column_info 表必须有这三个新字段 ‘mimetype’、’transformation’ 和 ‘transformation_options’ 。

从4.3.0版开始,引入了一种新的面向输入的转换系统。此外,删除了旧转换系统中使用的向后兼容性代码。因此,对于先前的转换和新的面向输入的转换系统来说,必须更新column_info表。 phpMyAdmin将通过分析您当前的column_info表结构自动为您升级它。但是,如果自动升级出现问题,那么您可以使用``./sql/upgrade_column_info_4_3_0+.sql``中的SQL脚本手动升级它。

要启用此功能:

  • 设置好 $cfg['Servers'][$i]['pmadb'] 和 phpMyAdmin 配置存储

  • $cfg['Servers'][$i]['column_info'] 中设置要使用的数据表名 (如:pma__column_info)

  • 要更新你的PRE-2.5.0 Column_comments表,使用这个: 并记住 config.inc.php`中的变量已从 :samp:`$cfg['Servers'][$i]['column_comments'] 被重命名到 $cfg['Servers'][$i]['column_info']

    ALTER TABLE `pma__column_comments`
    ADD `mimetype` VARCHAR( 255 ) NOT NULL,
    ADD `transformation` VARCHAR( 255 ) NOT NULL,
    ADD `transformation_options` VARCHAR( 255 ) NOT NULL;
    
  • 要手动更新PRE-4.3.0 Column_info表,使用这个``./sql/upgrade_column_info_4_3_0+.sql``SQL脚本。

可以通过将配置设置为``false``来禁用此功能。

注解

要使自动升级功能正常工作,你的 $cfg['Servers'][$i]['controluser'] 必须对``phpmyadmin``数据库具有ALTER权限。有关如何为用户提供``GRANT``特权,请参阅`GRANT的MySQL文档 <https://dev.mysql.com/doc/refman/8.0/en/grant.html>` 。

$cfg['Servers'][$i]['history']
类型:字符串或“false”
默认值:''

2.5.0 新版功能.

自 2.5.0 起你可以保存在 phpMyAdmin 中输入的 SQL 查询历史,即存储您手动输入到phpMyAdmin界面的所有查询。如果你不想使用基于数据表的历史记录,也可以使用基于 JavaScript 的历史记录。

使用它,关闭窗口时将删除所有历史记录项。通过 $cfg['QueryHistoryMax'] 可以定义保存历史记录的最大数量。过量历史记录的删除操作将在每次登录时执行。

查询历史仅在浏览器启用 JavaScript 时可用。

要启用此功能:

可以通过将配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['recent']
类型:字符串或“false”
默认值:''

3.5.0 新版功能.

从版本3.5.0开始,您可以在导航面板中显示最近使用的表格。它可以帮助您直接跳过表,而无需选择数据库,然后选择表。使用 $cfg['NumRecentTables'] 您可以配置显示的最近表的最大数量。当您从列表中选择一个表时,它将跳转到 $cfg['NavigationTreeDefaultTabTable'] 当中指定的页面。

如果不配置存储,您仍然可以访问最近使用的表,但在注销后它将消失。

要永久允许使用此功能:

可以通过将配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['favorite']
类型:字符串或“false”
默认值:''

4.2.0 新版功能.

从版本4.2.0开始,您可以在导航面板中显示所选表的列表。它可以帮助您直接跳转到表,而无需选择数据库,然后选择表。当您从列表中选择一个表时,它将跳转到 $cfg['NavigationTreeDefaultTabTable'] 当中指定的页面。

您可以通过单击表名旁边的星形图标将表添加到此列表或从数据库结构页中删除表。使用 $cfg['NumFavoriteTables'] 你可以配置显示的最喜欢的表数。

如果不配置存储,您仍然可以访问收藏表,但在注销后它将消失。

要永久允许使用此功能:

可以通过将配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['table_uiprefs']
类型:字符串或“false”
默认值:''

3.5.0 新版功能.

从版本3.5.0开始,phpMyAdmin可以配置为记住几个事项(排序列 $cfg['RememberSorting'],列顺序和数据库表中的列可见性)用于浏览表。如果不配置存储,仍可以使用这些功能,但注销后值将消失。

允许持久使用这些功能:

可以通过将配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['users']
类型:字符串或“false”
默认值:''

phpmyadmin是一个表,用于将用户名信息与用户组相关联。详细信息和推荐设置是:CONFIG:选项:选择:`$ CFG [‘服务器’] [$ i] [‘usergroups’oppers。

$cfg['Servers'][$i]['usergroups']
类型:字符串或“false”
默认值:''

4.1.0 新版功能.

从4.1.0版开始,您可以创建不同的用户组,并附加菜单项。可以将用户分配给这些组,并且登录用户只能看到配置给他分配给的用户组的菜单项。为此,它需要两个表“usergroups”(为每个用户组存储允许的菜单项)和“users”(将用户及其分配存储到用户组)。

要启用此功能:

可以通过将任一配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['navigationhiding']
类型:字符串或“false”
默认值:''

4.1.0 新版功能.

从4.1.0版开始,您可以隐藏/显示导航树中的项目。

要启用此功能:

可以通过将配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['central_columns']
类型:字符串或“false”
默认值:''

4.3.0 新版功能.

4.3.0版开始,您可以拥有每个数据库的列的中央列表。您可以根据需要在列表中添加/删除列。在为表创建新列或创建表本身时,可以使用中央列表中的这些列。您可以在创建新列时从中央列表中选择一列,这样可以避免再次编写相同的列定义或者为类似列编写不同的名称。

要启用此功能:

可以通过将配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['designer_settings']
类型:字符串或“false”
默认值:''

4.5.0 新版功能.

自发布 4.5.0 之后,您可以保存设计器设置。您选择的“折角/直接连接”、“吸附到网格”、“切换关系线”、“全部调小/大”、“移动菜单”和“固定住文本”选项可以永久保存下来。

要启用此功能:

可以通过将配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['savedsearches']
类型:字符串或“false”
默认值:''

4.2.0 新版功能.

从版本4.2.0开始,您可以从“数据库”>“查询”面板中保存并加载按示例搜索的搜索。

要启用此功能:

可以通过将配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['export_templates']
类型:字符串或“false”
默认值:''

4.5.0 新版功能.

自发布 4.5.0 以后,你可以保存和读取导出的模板。

要启用此功能:

可以通过将配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['tracking']
类型:字符串或“false”
默认值:''

3.3.x 新版功能.

自 3.3.x 起可以使用追踪功能。它可以帮你追踪每个通过 phpMyAdmin 执行的 SQL 命令。它支持记录数据修改和数据定义语句。启用后还可以创建数据表的版本。

创建版本会造成两个影响:

  • phpMyAdmin 保存当前数据表的快照,包括结构和索引。
  • phpMyAdmin 针对当前数据表记录的所有修改结构和/或数据的命令都将与版本关联。

当然你也能查看追踪到的修改。在”追踪”页里每个版本都会有一份完整的报告。你可以在报告中搜索,如你可以只列出一段时间内的语句。若想根据用户名搜索可以输入 * 表示任意用户或者输入 ‘,’ 分隔的用户列表。你还可以导出 (包括搜索结果) 报告为文件或者临时数据库。

要启用此功能:

  • 设置好 $cfg['Servers'][$i]['pmadb'] 和 phpMyAdmin 配置存储
  • 在 :config:option:`$cfg[‘Servers’][$i][‘tracking’] 中设置要使用的数据表名 (如:’pma_tracking’)

可以通过将配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['tracking_version_auto_create']
类型:布尔值
默认值:false

设置追踪系统是否自动为数据表和视图创建版本。

若设为 true 然后你通过

  • CREATE TABLE …
  • CREATE VIEW …

创建了一张表或视图并且它当前没有任何版本,系统将会自动为你创建一个版本。

$cfg['Servers'][$i]['tracking_default_statements']
类型:文本
默认值:'CREATE TABLE,ALTER TABLE,DROP TABLE,RENAME TABLE,CREATE INDEX,DROP INDEX,INSERT,UPDATE,DELETE,TRUNCATE,REPLACE,CREATE VIEW,ALTER VIEW,DROP VIEW,CREATE DATABASE,ALTER DATABASE,DROP DATABASE'

定义自动创建新版的命令列表。

$cfg['Servers'][$i]['tracking_add_drop_view']
类型:布尔值
默认值:true

设置当记录视图创建时,是否在前面加上 ‘DROP VIEW IF EXISTS’ 命令。

$cfg['Servers'][$i]['tracking_add_drop_table']
类型:布尔值
默认值:true

设置当记录数据表创建时,是否在前面加上 ‘DROP TABLE IF EXISTS’ 命令。

$cfg['Servers'][$i]['tracking_add_drop_database']
类型:布尔值
默认值:true

设置当记录数据库创建时,是否在前面加上 ‘DROP DATABASE IF EXISTS’ 命令。

$cfg['Servers'][$i]['userconfig']
类型:字符串或“false”
默认值:''

3.4.x 新版功能.

自 3.4.x 起 phpMyAdmin 允许用户自己设置大部分偏好并将设置保存在数据库中。

如果你不想让用户将偏好保存在 $cfg['Servers'][$i]['pmadb'] 中,用户仍然可以个性化 phpMyAdmin,但设置将会保存在浏览器本地存储中,或者,会话不可用,直到会话结束。

要启用此功能:

可以通过将配置设置为``false``来禁用此功能。

$cfg['Servers'][$i]['MaxTableUiprefs']
类型:整数
默认值:100

保存在:config:option:`$cfg[‘Servers’][$i][‘table_uiprefs’]`table中的最大行数。

当删除或重命名表时, $cfg['Servers'][$i]['table_uiprefs'] 可能包含无效数据(指不再存在的表)。我们只在 $cfg['Servers'][$i]['table_uiprefs'] 中保留这个最新的行数,然后自动删除旧的行。

$cfg['Servers'][$i]['SessionTimeZone']
类型:文本
默认值:''

设置 phpMyAdmin 所使用的时区。留空将使用数据库服务器的时区。可能的值在 https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html 中说明

当您的数据库服务器使用的时区不同于您要在 phpMyAdmin 中使用的时区时,这非常有用。

$cfg['Servers'][$i]['AllowRoot']
类型:布尔值
默认值:true

设置是否允许 root 用户访问。此为 $cfg['Servers'][$i]['AllowDeny']['rules'] 的快速设置。

$cfg['Servers'][$i]['AllowNoPassword']
类型:布尔值
默认值:false

设置是否允许不使用密码登录。为了防止可能存在空密码的 root 或者其他匿名 (空) 用户访问到 MySQL 服务器,此项默认为 false

$cfg['Servers'][$i]['AllowDeny']['order']
类型:文本
默认值:''

若不指定规则顺序,IP 认证将不可用。

若将规则顺序设为``’deny,allow’``,系统将首先应用所有的禁止 (deny) 规则,然后再应用允许规则 (allow) 。默认允许访问,任何没有被 Deny (禁止) 命令匹配的客户端或者被 Allow (允许) 命令匹配的客户端将被允许访问服务器。

若将规则顺序设为 'allow,deny',系统将首先应用所有的允许 (allow) 规则,然后再应用禁止 (deny) 规则。默认禁止访问,任何没有被 Allow (允许) 命令匹配的客户端或者被 Deny (禁止) 命令匹配的客户端将被禁止访问服务器。

若将规则顺序设为 'explicit' ,认证行为与设为 ‘deny,allow’ 相似,但同时额外要求主机/用户名组合**必须**在**允许 (allow)** 规则中列出且不能在**禁止 (deny)** 规则中出现。这是**最**安全的方式,并且相当于在 Apache 中使用允许 (allow)、禁止 (deny) 规则但不指定顺序时的效果。

同时请参见 $cfg['TrustedProxies'] 探测使用代理的真实 IP 。

$cfg['Servers'][$i]['AllowDeny']['rules']
类型:字符串数组
默认值:array()

规则的格式通常为:

<'allow' | 'deny'> <username> [from] <ipmask>

如果要匹配所有用户,请在*用户名*一栏中使用通配符 '%'

有几个 IP 地址掩码 一栏的缩写可以使用(请注意包含 SERVER_ADDRESS 的条目可能对某些网站服务器无效):

'all' -> 0.0.0.0/0
'localhost' -> 127.0.0.1/8
'localnetA' -> SERVER_ADDRESS/8
'localnetB' -> SERVER_ADDRESS/16
'localnetC' -> SERVER_ADDRESS/24

在规则顺序为 'deny,allow' 时,空的规则列表等价于 'allow % from all' ;规则顺序为 'allow,deny''explicit' 时等价于 'deny % from all'

对于 :IP 地址 匹配系统来说,下列形式是有效的:

  • xxx.xxx.xxx.xxx (一个具体的 :term:`IP`地址)
  • xxx.xxx.xxx.[yyy-zzz] (一个 IP 地址 范围)
  • xxx.xxx.xxx.xxx/nn (CIDR,无类别域间路由类型的 IP 地址范围)

而下列形式是无效的:

  • xxx.xxx.xxx.xx[yyy-zzz] (部分 IP 地址范围)

对于 :term:`IPv6`地址,下列形式是有效的:

  • xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx (一个具体的 IPv6 地址)
  • xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:[yyyy-zzzz] (一段 IPv6 地址范围)
  • xxxx:xxxx:xxxx:xxxx/nn (CIDR,无类别域间路由类型的 IPv6 地址范围)

而下列形式是无效的:

  • xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xx[yyy-zzz] (部分 IPv6 地址范围)

如:

$cfg['Servers'][$i]['AllowDeny']['order'] = 'allow,deny';
$cfg['Servers'][$i]['AllowDeny']['rules'] = ['allow bob from all'];
// Allow only 'bob' to connect from any host

$cfg['Servers'][$i]['AllowDeny']['order'] = 'allow,deny';
$cfg['Servers'][$i]['AllowDeny']['rules'] = ['allow mary from 192.168.100.[50-100]'];
// Allow only 'mary' to connect from host 192.168.100.50 through 192.168.100.100

$cfg['Servers'][$i]['AllowDeny']['order'] = 'allow,deny';
$cfg['Servers'][$i]['AllowDeny']['rules'] = ['allow % from 192.168.[5-6].10'];
// Allow any user to connect from host 192.168.5.10 or 192.168.6.10

$cfg['Servers'][$i]['AllowDeny']['order'] = 'allow,deny';
$cfg['Servers'][$i]['AllowDeny']['rules'] = ['allow root from 192.168.5.50','allow % from 192.168.6.10'];
// Allow any user to connect from 192.168.6.10, and additionally allow root to connect from 192.168.5.50
$cfg['Servers'][$i]['DisableIS']
类型:布尔值
默认值:false

设置是否禁止通过 INFORMATION_SCHEMA 来获取信息(用 SHOW 命令代替),若不禁止且数据库很多时可能会造成性能下降。

注解

启用该选项可能会让您的老 MySQL 服务器的性能得到大幅度提升。

$cfg['Servers'][$i]['SignonScript']
类型:文本
默认值:''

3.5.0 新版功能.

获取登录凭证所需的源代码和执行的PHP脚本的名称。这是基于会话的单点登录的替代方法。脚本必须提供一个名为“get_login_credentials”的函数,该函数返回用户名和密码列表,接受现有用户名的单个参数(可以为空)。请参阅:file:examples/signon-script.php 例如:

<?php
/**
 * Single signon for phpMyAdmin
 *
 * This is just example how to use script based single signon with
 * phpMyAdmin, it is not intended to be perfect code and look, only
 * shows how you can integrate this functionality in your application.
 */

declare(strict_types=1);

// phpcs:disable Squiz.Functions.GlobalFunction

/**
 * This function returns username and password.
 *
 * It can optionally use configured username as parameter.
 *
 * @param string $user User name
 *
 * @return array<int,string>
 */
function get_login_credentials(string $user): array
{
    /* Optionally we can use passed username */
    if (! empty($user)) {
        return [$user, 'password'];
    }

    /* Here we would retrieve the credentials */
    return ['root', ''];
}
$cfg['Servers'][$i]['SignonSession']
类型:文本
默认值:''

用于登录身份验证方法的会话的名称。名称``phpmyadmin``是phpmyadmin在内部使用的会话,因此它必须使用不同的名称。:Config:选项:`$ CFG [‘服务器’] [$ i] [‘sengsonecript’]如果您不取消,这将无法正常工作。

$cfg['Servers'][$i]['SignonCookieParams']
类型:数组
默认值:array()

4.7.0 新版功能.

其他身份验证系统的会话cookie参数关联数组。如果未使用session_set_cookie_params(),则不需要其他身份验证系统。该密钥指定了“生命周期”,“路径”,“域”,“安全”,“HttpOnly”。有效值在`session_get_cookie_params <https://www.php.net/manual/en/function.session-get-cookie-params.php>`_中介绍了有效值。:Config:选项:`$ CFG [‘服务器’] [$ i] [$ i] [‘sengsonscript’]才有效,只有在未设置’signarecript’’’。

$cfg['Servers'][$i]['SignonURL']
类型:文本
默认值:''

使用 signon 认证时用户将转到登录的 URL 。应为包含协议的绝对地址。

$cfg['Servers'][$i]['LogoutURL']
类型:文本
默认值:''

使用 signon 认证时用户退出后将转到的 :term:`URL`(不影响配置中的认证方法)。应为包含协议的绝对地址。

$cfg['Servers'][$i]['hide_connection_errors']
类型:布尔值
默认值:false

4.9.8 新版功能.

是否在登录页面上显示或隐藏详细的MySQL/MariaDB连接错误。

注解

此错误消息可能包含目标数据库服务器主机名或IP地址,这可能会向攻击者泄露有关网络的信息。

基本设置

$cfg['DisableShortcutKeys']
类型:布尔值
默认值:false

您可以通过设置 $cfg[‘DisableShortcutKeys’] 为 true 禁用 phpMyAdmin 快捷键。

$cfg['ServerDefault']
类型:整数
默认值:1

如果有多个服务器设置,你可以设置 $cfg['ServerDefault'] 为其中之一,phpMyAdmin 将会自动连接,若设为 0 则将在登录页面显示服务器列表。

如果只有一个服务器设置,$cfg['ServerDefault'] 必须设为那台服务器。

$cfg['VersionCheck']
类型:布尔值
默认值:true

允许在 phpMyAdmin 主页面中使用 JavaScript 或通过直接访问 index.php?route=/version-check 检查新版本。

注解

此设置可能会更改供应商。

$cfg['ProxyUrl']
类型:文本
默认值:''

当phpmyadmin需要访问外部internet时(例如检索最新版本信息或提交错误报告时),要使用的代理的url。如果安装了phpMyAdmin的服务器无法直接访问internet,则需要此选项。格式为:“主机名:端口号”

$cfg['ProxyUser']
类型:文本
默认值:''

连接代理服务器时使用的用户名。如果提供用户名,将使用基本认证方式连接。目前还不支持其他认证方式。

$cfg['ProxyPass']
类型:文本
默认值:''

代理服务的密码.

$cfg['MaxDbList']
类型:整数
默认值:100

主面板上数据库列表显示数据库名称的最大数量。

$cfg['MaxTableList']
类型:整数
默认值:250

主面板显示表格名称的最大数量(除了导出页面外)。

$cfg['ShowHint']
类型:布尔值
默认值:true

是否显示提示(当鼠标光标重叠在表格零件上时显示)。

$cfg['MaxCharactersInDisplayedSQL']
类型:整数
默认值:1000

显示 SQL 查询的最大字数。默认值 1000 通常可以避免 BLOB 字段中十六进制内容的显示,但有些用户确实有超过 1000 个字符的 SQL 查询。另外,如果一个查询超过了这个限制,也将不会保存在查询历史中。

$cfg['PersistentConnections']
类型:布尔值
默认值:false

是否使用 `持久连接<https://www.php.net/manual/en/features .persistent-connections.php>`_

$cfg['ForceSSL']
类型:布尔值
默认值:false

4.6.0 版后已移除: PHPMYADMIN 4.6.0后,此设置无效。请设置Web服务器。

设置在访问 phpMyAdmin 时是否强制使用 https 安全连接。在反向代理配置中,不支持将此选项设置为 true

注解

在某些设置(如分离的SSL代理,负载均衡)中,需要设置 $cfg['PmaAbsoluteUri'] 以获得正确的重定向。

$cfg['MysqlSslWarningSafeHosts']
类型:数组
默认值:['127.0.0.1', 'localhost']

此搜索区分大小写,仅搜索严格的匹配字符串。如果您未使用SSL,则知道使用本地连接或专用网络是安全的,您可以添加主机名或:术语:`IP`地址到列表。您还可以删除默认项目,仅包含您的项目。

这个检查使用 $cfg['Servers'][$i]['host'] 的值。

5.1.0 新版功能.

示例配置

$cfg['MysqlSslWarningSafeHosts'] = ['127.0.0.1', 'localhost', 'mariadb.local'];
$cfg['ExecTimeLimit']
类型:整数 [单位: 秒]
默认值:300

设置允许脚本运行的最长时间。如果设置为0,则不施加时间限制。此设置用于在 PHP 安全模式下导入/导出转储文件没有效果时调整。

$cfg['SessionSavePath']
类型:文本
默认值:''

保存会话数据的路径(PHP 参数 session_save_path )。

警告

不得通过Web服务器访问此文件夹。私有数据从会话泄漏存在风险。

$cfg['MemoryLimit']
类型:字符串 [单位: 字节]
默认值:'-1'

设置脚本运行的可使用的内存大小。若设为 '-1' 则没有额外限制,若设为 '0' ,则不尝试改变内存限制,且会应用 php.inimemory_limit 配置项。

本设置用于导入/导出转储文件以及 phpMyAdmin 的其他功能,所以显然不要设置一个很小的值。若 PHP 运行于安全模式则无效。

同样可以设置为 php.ini 文件可以识别的字符串,如 ‘16M’ 。请确保没有丢掉后缀(16 表示 16 字节!)

$cfg['SkipLockedTables']
类型:布尔值
默认值:false

标记正在使用的表以使得可以显示含有已锁定表的数据库 (自 MySQL 3.23.30 起) 。

$cfg['ShowSQL']
类型:布尔值
默认值:true

设置是否显示 phpMyAdmin 生成的 SQL 查询语句。

$cfg['RetainQueryBox']
类型:布尔值
默认值:false

设置是否在提交查询后保持显示 SQL 查询框。

$cfg['CodemirrorEnable']
类型:布尔值
默认值:true

定义是否在SQL查询框中使用JavaScript代码编辑器。Codemirror允许您显示语法强调和行号。但是,所有浏览器都不支持由几个Linux发行版(例如Ubuntu)提供的中间按钮的粘贴。

$cfg['LintEnable']
类型:布尔值
默认值:true

4.5.0 新版功能.

定义在执行之前是否使用解析器查找查询中的任何错误。

$cfg['DefaultForeignKeyChecks']
类型:文本
默认值:``’默认’

禁用/启用指定查询的外键检查这是外键复选框的复选框的默认值,可指定的值是 '默认''启用''禁用' 。当设置为 '默认' 时,使用 MySQL 环境变量 FOREIGN_KEY_CHECKS 的值。

$cfg['AllowUserDropDatabase']
类型:布尔值
默认值:false

警告

这不是安全措施,因为它始终存在如何避免这种情况。如果用户想要禁用删除数据库,请禁用相应的丢弃权限。

设置普通用户 (非管理员) 是否可以删除他们自己的数据库。若设为 false,链接 删除数据库 将不会显示出来, DROP DATABASE mydatabase 语句也会被拒绝。该功能对于有很多客户的 ISP 相当有用。

请注意这里对 SQL 查询的限制并不能像使用 MySQL 权限限制那样严格。因为 SQL 查询可以非常复杂。所以该功能应作为避免误删除数据库而不是严格的权限限制来使用。

$cfg['Confirm']
类型:布尔值
默认值:true

设置可能丢失数据时是否显示警告(“Are you really sure …”) 。

$cfg['UseDbSearch']
类型:布尔值
默认值:true

设置是否允许使用 “数据库搜索” 。

$cfg['IgnoreMultiSubmitErrors']
类型:布尔值
默认值:false

设置 phpMyAdmin 是否在执行多语句查询出错的时候继续执行。默认为中断执行。

$cfg['enable_drag_drop_import']
类型:布尔值
默认值:true

是否启用了通过拖放的导入功能。如果用户将文件拖动到浏览器(如果已启用),PHPMyAdmin会尝试导入文件。

$cfg['URLQueryEncryption']
类型:布尔值
默认值:false

4.9.8 新版功能.

设置 phpMyAdmin 是否对 URL 查询参数的敏感数据(如数据库名和表名)进行加密。默认不进行加密。

$cfg['URLQueryEncryptionSecretKey']
类型:文本
默认值:''

4.9.8 新版功能.

用于加密/解密URL查询字符串的密钥。应该是32字节长。

$cfg['maxRowPlotLimit']
类型:整数
默认值:500

从区域搜索获取的最大行数。

主面板

$cfg['ShowStats']
类型:布尔值
默认值:true

定义是否显示有关数据库和表的空间使用情况和统计信息。请注意,统计信息至少需要MySQL 3.23.3,并且目前MySQL不会为Berkeley DB表返回此类信息。

$cfg['ShowServerInfo']
类型:布尔值|文本
默认值:true

定义是否在主页上显示详细的服务器信息。可能的值为:

  • true 显示所有服务器信息
  • false 隐藏服务器信息
  • 'database-server' 仅显示数据库服务器信息
  • 'web-server' 仅显示web服务器信息

您还可以使用 $cfg['Servers'][$i]['verbose'] 隐藏更多信息。

在 6.0.0 版更改: 添加了 'database-server''web-server' 选项。

$cfg['ShowPhpInfo']
类型:布尔值
默认值:false

设置是否在主 (右侧) 框架中显示 PHP 信息

请注意若要限制脚本使用 phpinfo() 函数,你必须在 php.ini 中设置:

disable_functions = phpinfo()

警告

启用 phpinfo 页会泄露很多关于服务器设置的信息,不推荐在共享安装中这样做。

这也可能会使得针对您安装实例的远程攻击更容易,所以请仅在需要时启用它。

$cfg['ShowChgPassword']
类型:布尔值
默认值:true

设置是否在主 (右侧) 框架中显示 :guilabel`修改密码` 链接。此设置不检查直接输入的 MySQL 命令。

注意:启用 修改密码 链接不影响所配置的认证方式,因为密码以硬编码形式保存在配置文件中,且终端用户不允许修改它们的密码。

$cfg['ShowCreateDb']
类型:布尔值
默认值:true

设置是否在主 (右侧) 框架中显示创建数据库表单。此设置不检查直接输入的 MySQL 命令。

$cfg['ShowGitRevision']
类型:布尔值
默认值:true

定义是否在主面板上显示有关当前Git版本(如果适用)的信息。

$cfg['MysqlMinVersion']
类型:数组

定义支持的最低 MySQL 版本。默认值由 phpMyAdmin 团队选择;然而,Plesk 控制面板的开发人员要求此指令以简化与较旧的 MySQL 服务器(大多数 phpMyAdmin 功能在其中工作)的集成。

数据库结构

$cfg['ShowDbStructureCharset']
类型:布尔值
默认值:false

定义是否在数据库结构视图中显示所有表格的字符集。

$cfg['ShowDbStructureComment']
类型:布尔值
默认值:false

定义是否在表结构视图中显示所有表格的注释。

$cfg['ShowDbStructureCreation']
类型:布尔值
默认值:false

定义数据库结构页(数据表列表)是否有一个 “创建 “列,显示每个表的创建时间。

$cfg['ShowDbStructureLastUpdate']
类型:布尔值
默认值:false

定义数据库结构页(数据表列表)是否有一个 “最后更新 “字段,显示每个表最后更新的时间。

$cfg['ShowDbStructureLastCheck']
类型:布尔值
默认值:false

定义数据库结构页(数据表列表)是否有一个 “最后检查” 列,显示每个表最后检查的时间。

$cfg['HideStructureActions']
类型:布尔值
默认值:true

是否将对表结构的相关操作隐藏在“ 更多 ”下拉菜单中。

$cfg['ShowColumnComments']
类型:布尔值
默认值:true

定义是否在表结构视图中将列注释显示为列。

浏览模式

$cfg['TableNavigationLinksMode']
类型:文本
默认值:'icons'

定义表格导航链接是否包含 'icons'``(图标)、’text’``(文本)或 ``’both’``(两者) 。

$cfg['ActionLinksMode']
类型:文本
默认值:'both'

如果设置为 icons,将显示图标而不是数据库和表属性链接的文本(如:BrowseSelectInsert……)。如果需要图标和文本,可以设置为 'both'。当设置为 text 时,将只显示文本。

$cfg['RowActionType']
类型:文本
默认值:'both'

是否在表行操作段中显示图标或文本或同时显示图标和文本。值可以是 'icons'``(图标)、’text’``(文本)或 ``’both’``(两者)之一。

$cfg['ShowAll']
类型:布尔值
默认值:false

定义是否在所有情况下都应在浏览模式下向用户展示“显示全部”按钮。默认情况下,它仅在小表(少于 500 行)上显示,以避免在获取太多行时出现性能问题。

$cfg['MaxRows']
类型:整数
默认值:25

浏览一个结果集时一次显示的最多行数。如果结果集超过此值,将会显示“ 上一页 ” 和“ 下一页 ”的链接。可能的取值:25、50、100、250及500。

$cfg['Order']
类型:文本
默认值:'SMART'

定义列是按升序(ASC)、降序(DESC)还是“智能”(SMART)顺序显示——即,TIME、DATE、DATETIME 和 TIMESTAMP 类型列的降序排列,否则默认为升序排列。

在 3.4.0 版更改: 从 phpMyAdmin 3.4.0 开始,默认值为 'SMART'

$cfg['DisplayBinaryAsHex']
类型:布尔值
默认值:true

定义“将二进制内容显示为十六进制”浏览选项是否默认勾选。

3.3.0 新版功能.

4.3.0 版后已移除: 此设置已删除。

$cfg['GridEditing']
类型:文本
默认值:'double-click'

定义哪个动作(double-click``(双击)或 ``click``(单击))触发网格编辑。可以使用 ``disabled 值停用。

$cfg['RelationalDisplay']
类型:文本
默认值:'K'

定义选项 > 关系的初始行为。K 为默认值,显示键;而``D`` 显示列。

$cfg['SaveCellsAtOnce']
类型:布尔值
默认值:false

定义是否一次保存所有编辑的单元格以进行网格编辑。

编辑模式

$cfg['ProtectBinary']
类型:布尔值或字符串
默认值:'blob'

定义在浏览表的内容时,是否保护 BLOBBINARY 列不被编辑。有效值为:

  • false 以允许编辑所有列
  • 'blob' 以允许编辑所有除了 BLOBS 的列
  • 'noblob' to disallow editing of all columns except BLOBS (the opposite of 'blob');
  • 'all' to disallow editing of all BINARY or BLOB columns.
$cfg['ShowFunctionFields']
类型:布尔值
默认值:true

定义MySQL函数字段最初是否应以编辑/插入模式显示。自2.10版以来,用户可以从界面上切换这一设置。

$cfg['ShowFieldTypesInDataEditView']
类型:布尔值
默认值:true

定义类型字段最初是否应以编辑/插入模式显示。用户可以在界面上切换这一设置。

$cfg['InsertRows']
类型:整数
默认值:2

定义了在插入页面上输入的默认行数。用户可以从该页面的底部手动更改,以添加或删除空白行。

$cfg['ForeignKeyMaxLimit']
类型:整数
默认值:100

如果外键集合中的项目少于此数,那么就会出现一个外键的下拉框,其样式由 $cfg['ForeignKeyDropdownOrder'] 设置描述。

$cfg['ForeignKeyDropdownOrder']
类型:数组
默认值:array(‘content-id’, ‘id-content’)

For the foreign key drop-down fields, there are several methods of display, offering both the key and value data. The contents of the array should be one or both of the following strings: content-id, id-content.

导入与导出设置

$cfg['ZipDump']
类型:布尔值
默认值:true
$cfg['GZipDump']
类型:布尔值
默认值:true
$cfg['BZipDump']
类型:布尔值
默认值:true

设置在创建转储文件时是否允许使用 zip/GZip/BZip2 压缩

$cfg['CompressOnFly']
类型:布尔值
默认值:true

定义是否允许对GZip/BZip2压缩输出进行即时压缩。这不影响较小的转储,并允许用户创建更大的转储,否则由于php的内存限制,将无法装入内存。产生的文件包含更多的GZip/BZip2头文件,但所有正常的程序都能正确处理这个问题。

$cfg['Export']
类型:数组
默认值:array(…)

In this array are defined default parameters for export, names of items are similar to texts seen on export page, so you can easily identify what they mean.

$cfg['Export']['format']
类型:文本
默认值:'sql'

默认导出格式。

$cfg['Export']['method']
类型:文本
默认值:'quick'

定义导出表单加载时的显示方式。有效值是:

  • quick——仅显示最小数目的配置项
  • custom——显示所有可用的配置项
  • custom-no-form same as custom but does not display the option of using quick export
$cfg['Export']['compression']
类型:文本
默认值:'none'

默认导出压缩方法。可能的值为 'none''zip''gzip'

$cfg['Export']['charset']
类型:文本
默认值:''

定义生成输出的字符集。默认情况下,假设为UTF-8,则不进行字符集转换。

$cfg['Export']['file_template_table']
类型:文本
默认值:'@TABLE@'

表格导出的默认文件名模板。

$cfg['Export']['file_template_database']
类型:文本
默认值:'@DATABASE@'

数据库或模板导出的默认文件名。

$cfg['Export']['file_template_server']
类型:文本
默认值:'@SERVER@'

服务器导出的默认文件名模板。

$cfg['Export']['remove_definer_from_definitions']
类型:布尔值
默认值:false

从事件、视图和例程定义中删除 DEFINER 语句。

5.2.0 新版功能.

$cfg['Import']
类型:数组
默认值:array(…)

在这个数组中,定义了导入的默认参数,项目的名称与导入页面上的文本相似,所以你可以很容易地识别它们的含义。

$cfg['Import']['charset']
类型:文本
默认值:''

定义导出的字符集,默认假定为 UTF-8,不进行转换。

$cfg['Schema']
类型:数组
默认值:array(…)
$cfg['Schema']['format']
类型:文本
默认值:'pdf'

定义模式输出的默认格式。可能的值是 'pdf''eps''dia''svg'

标签页显示设置

$cfg['TabsMode']
类型:文本
默认值:'both'

Defines whether the menu tabs contain 'icons', 'text' or 'both'.

$cfg['PropertiesNumColumns']
类型:整数
默认值:1

将利用多少列来显示数据库属性视图上的表?当设置为大于1的值时,数据库的类型将被省略以获得更多的显示空间。

$cfg['DefaultTabServer']
类型:文本
默认值:'welcome'

定义默认情况下在服务器视图上显示的选项卡。可能的值是以下的本地化等效值:

  • welcome (recommended for multi-user setups)
  • databases,
  • status
  • variables
  • privileges
$cfg['DefaultTabDatabase']
类型:文本
默认值:'structure'

定义数据库视图中默认显示的选项卡。可能的值是以下的本地化等效值:

  • structure
  • sql
  • search
  • operations
$cfg['DefaultTabTable']
类型:文本
默认值:'browse'

定义默认情况下在表视图上显示的选项卡。可能的值是以下的本地化等效值:

  • structure
  • sql
  • search
  • insert
  • browse

PDF 选项

$cfg['PDFPageSizes']
类型:数组
默认值:array('A3', 'A4', 'A5', 'letter', 'legal')

用于创建PDF页面的可能纸张尺寸数组。

应该不需要改变它。

$cfg['PDFDefaultPageSize']
类型:文本
默认值:'A4'

创建PDF页面所使用的默认页面尺寸。所有有效的值在 $cfg['PDFPageSizes'] 中列出。

语言

$cfg['DefaultLang']
类型:文本
默认值:'en'

定义了浏览器及用户未定义情况下的默认语言。locale/code/LC_MESSAGES/phpmyadmin.mo 中应有相应的语言文件。

$cfg['DefaultConnectionCollation']
类型:文本
默认值:'utf8mb4_general_ci'

如果用户没有另行定义,则定义默认的连接整理方式。参见 MySQL文档中的字符集 ,以获得可能的值列表。

$cfg['Lang']
类型:文本
默认值:暂未设置

强制使用的语言。locale/code/LC_MESSAGES/phpmyadmin.mo 中应有相应的语言文件。

$cfg['FilterLanguages']
类型:文本
默认值:''

通过正则表达式限制可用语言列表。例如只允许使用简体中文和英语,可以设置为 '^(zh_CN|en)'

$cfg['RecodingEngine']
类型:文本
默认值:'auto'

你可以在这里选择使用哪个函数来转换字符集。可选值有:

  • 'auto' - automatically use available one (first is tested iconv, then mbstring)
  • 'iconv' - use iconv or libiconv functions
  • 'mb' - use mbstring extension
  • 'none' - disable encoding conversion

启用编码转换后将会在导出和导入页面显示一个用于选择导出文件字符集的下拉菜单。其默认值来自 $cfg[‘Export’][‘charset’]$cfg[‘Import’][‘charset’]

在 6.0.0 版更改: Support for the Recode extension has been removed. The 'recode' value is ignored and the default value ('auto') is used instead.

$cfg['IconvExtraParams']
类型:文本
默认值:'//TRANSLIT'

Specify some parameters for iconv used in charset conversion. See iconv documentation for details. By default //TRANSLIT is used, so that invalid characters will be transliterated.

$cfg['AvailableCharsets']
类型:数组
默认值:array(…)

Available character sets for MySQL conversion. You can add your own (any of supported by mbstring/iconv) or remove these which you don’t use. Character sets will be shown in same order as here listed, so if you frequently use some of these move them to the top.

Web 服务器设置

$cfg['OBGzip']
类型:string/boolean
默认值:'auto'

设为 true/false 以启用/禁用。当设为 ‘auto’ (字符串) 时,phpMyAdmin 将尝试启用输出缓冲并在浏览器对缓冲支持有问题时自动禁用。已知具有特定补丁的 IE6 会在启用缓冲时导致数据损坏。

$cfg['TrustedProxies']
类型:数组
默认值:array()

Lists proxies and HTTP headers which are trusted for $cfg['Servers'][$i]['AllowDeny']['order']. This list is by default empty, you need to fill in some trusted proxy servers if you want to use rules for IP addresses behind proxy.

下面的例子指定了 phpMyAdmin 应该信任从代理 1.2.3.4 发来的 HTTP_X_FORWARDED_FOR(X-Forwarded-For)头:

$cfg['TrustedProxies'] = ['1.2.3.4' => 'HTTP_X_FORWARDED_FOR'];

The $cfg['Servers'][$i]['AllowDeny']['rules'] directive uses the client’s IP address as usual.

$cfg['GD2Available']
类型:文本
默认值:'auto'

指定 GD &gt;= 2 版本是否可用。它将被用于 MIME 类型转换。可能的值包括:

  • auto——自动检测
  • 是 (yes) - GD 2 函数库可以使用
  • 否 (no) - GD 2 函数库不可用
$cfg['CheckConfigurationPermissions']
类型:布尔值
默认值:true

通常情况下我们会检查配置文件确保不是所有人都能修改它。然而 phpMyAdmin 可能被安装在非 Windows 服务器的 NTFS 文件系统中,在这种情况下看起来权限是错误的但实际上我们无法检测。此时系统管理员应将该指令设为 false

$cfg['LinkLengthLimit']
类型:整数
默认值:1000

Limit for length of URL in links. When length would be above this limit, it is replaced by form with button. This is required as some web servers (IIS) have problems with long URL .

$cfg['CSPAllow']
类型:文本
默认值:''

额外的字符串,包括在内容安全策略(CSP)标头中允许的脚本和图像来源。

This can be useful when you want to include some external JavaScript files in config.footer.inc.php or config.header.inc.php, which would be normally not allowed by Content Security Policy.

To allow some sites, just list them within the string:

$cfg['CSPAllow'] = 'example.com example.net';

4.0.4 新版功能.

$cfg['DisableMultiTableMaintenance']
类型:布尔值
默认值:false

In the database Structure page, it’s possible to mark some tables then choose an operation like optimizing for many tables. This can slow down a server; therefore, setting this to true prevents this kind of multiple maintenance operation.

主题设置

请直接修改 themes/themename/scss/_variables.scss,你的修改可能会在下次更新时被覆盖。

自定义设计

$cfg['NavigationTreePointerEnable']
类型:布尔值
默认值:true

When set to true, hovering over an item in the navigation panel causes that item to be marked (the background is highlighted).

$cfg['BrowsePointerEnable']
类型:布尔值
默认值:true

When set to true, hovering over a row in the Browse page causes that row to be marked (the background is highlighted).

$cfg['BrowseMarkerEnable']
类型:布尔值
默认值:true

When set to true, a data row is marked (the background is highlighted) when the row is selected with the checkbox.

$cfg['LimitChars']
类型:整数
默认值:50

Maximum number of characters shown in any non-numeric field on browse view. Can be turned off by a toggle button on the browse page.

类型:文本
默认值:'left'

Defines the place where table row links (Edit, Copy, Delete) would be put when tables contents are displayed (you may have them displayed at the left side, right side, both sides or nowhere).

$cfg['RowActionLinksWithoutUnique']
类型:布尔值
默认值:false

Defines whether to show row links (Edit, Copy, Delete) and checkboxes for multiple row operations even when the selection does not have a unique key. Using row actions in the absence of a unique key may result in different/more rows being affected since there is no guaranteed way to select the exact row(s).

$cfg['RememberSorting']
类型:布尔值
默认值:true

If enabled, remember the sorting of each table when browsing them.

$cfg['TablePrimaryKeyOrder']
类型:文本
默认值:'NONE'

This defines the default sort order for the tables, having a primary key, when there is no sort order defines externally. Acceptable values : [‘NONE’, ‘ASC’, ‘DESC’]

$cfg['ShowBrowseComments']
类型:布尔值
默认值:true
$cfg['ShowPropertyComments']
类型:布尔值
默认值:true

By setting the corresponding variable to true you can enable the display of column comments in Browse or Property display. In browse mode, the comments are shown inside the header. In property mode, comments are displayed using a CSS-formatted dashed-line below the name of the column. The comment is shown as a tool-tip for that column.

$cfg['FirstDayOfCalendar']
类型:整数
默认值:0

This will define the first day of week in the calendar. The number can be set from 0 to 6, which represents the seven days of the week, Sunday to Saturday respectively. This value can also be configured by the user in Settings -> Features -> General -> First day of calendar field.

文本字段

$cfg['CharEditing']
类型:文本
默认值:'input'

设置编辑 CHAR 和 VARCHAR 类型字段时应使用何种控件。应用于数据编辑和结构编辑的默认值。可选值有:

  • 输入框 (input) - 允许限制输入字数使其不超过 MySQL 字段限制,但无法换行
  • 文本框 (textarea) - 可以换行,但没有字数限制
$cfg['MinSizeForInputField']
类型:整数
默认值:4

定义了当编辑 CHAR 和 VARCHAR 字段时所使用输入框的最小大小。

$cfg['MaxSizeForInputField']
类型:整数
默认值:60

定义了当编辑 CHAR 和 VARCHAR 字段时所使用输入框的最大大小。

$cfg['TextareaCols']
类型:整数
默认值:40
$cfg['TextareaRows']
类型:整数
默认值:15
$cfg['CharTextareaCols']
类型:整数
默认值:40
$cfg['CharTextareaRows']
类型:整数
默认值:7

Number of columns and rows for the textareas. This value will be emphasized (*2) for SQL query textareas and (*1.25) for SQL textareas inside the query window.

The Char* values are used for CHAR and VARCHAR editing (if configured via $cfg['CharEditing']).

在 5.0.0 版更改: 默认值从2变化为7。

$cfg['LongtextDoubleTextarea']
类型:布尔值
默认值:true

Defines whether textarea for LONGTEXT columns should have double size.

$cfg['TextareaAutoSelect']
类型:布尔值
默认值:false

Defines if the whole textarea of the query box will be selected on click.

$cfg['EnableAutocompleteForTablesAndColumns']
类型:布尔值
默认值:true

是否在任何SQL查询框中启用表和字段名的自动完成功能。

SQL 查询框设定

$cfg['SQLQuery']['Edit']
类型:布尔值
默认值:true

是否显示编辑链接以改变任何SQL查询框中的查询。

$cfg['SQLQuery']['Explain']
类型:布尔值
默认值:true

是否在任何SQL查询框中显示一个解释SELECT查询的链接。

$cfg['SQLQuery']['ShowAsPHP']
类型:布尔值
默认值:true

是否在任何SQL查询框中显示一个用PHP代码包装查询的链接。

$cfg['SQLQuery']['Refresh']
类型:布尔值
默认值:true

是否在任何SQL查询框中显示一个刷新查询的链接。

Web 服务器上传/保存/导入目录

If PHP is running in safe mode, all directories must be owned by the same user as the owner of the phpMyAdmin scripts.

If the directory where phpMyAdmin is installed is subject to an open_basedir restriction, you need to create a temporary directory in some directory accessible by the PHP interpreter.

For security reasons, all directories should be outside the tree published by webserver. If you cannot avoid having this directory published by webserver, limit access to it either by web server configuration (for example using .htaccess or web.config files) or place at least an empty index.html file there, so that directory listing is not possible. However as long as the directory is accessible by web server, an attacker can guess filenames to download the files.

$cfg['UploadDir']
类型:文本
默认值:''

The name of the directory where SQL files have been uploaded by other means than phpMyAdmin (for example, FTP). Those files are available under a drop-down box when you click the database or table name, then the Import tab.

If you want different directory for each user, %u will be replaced with username.

Please note that the file names must have the suffix “.sql” (or “.sql.bz2” or “.sql.gz” if support for compressed formats is enabled).

This feature is useful when your file is too big to be uploaded via HTTP, or when file uploads are disabled in PHP.

警告

Please see top of this chapter (Web 服务器上传/保存/导入目录) for instructions how to setup this directory and how to make its usage secure.

$cfg['SaveDir']
类型:文本
默认值:''

服务器上用来保存导出文件的文件夹。

If you want a different directory for each user, %u will be replaced with the username.

Please note that the directory must exist and has to be writable for the user running webserver.

警告

Please see top of this chapter (Web 服务器上传/保存/导入目录) for instructions how to setup this directory and how to make its usage secure.

$cfg['TempDir']
类型:文本
默认值:'./tmp/'

The name of the directory where temporary files can be stored. It is used for several purposes, currently:

This directory should have as strict permissions as possible as the only user required to access this directory is the one who runs the webserver. If you have root privileges, simply make this user owner of this directory and make it accessible only by it:

chown www-data:www-data tmp
chmod 700 tmp

If you cannot change owner of the directory, you can achieve a similar setup using ACL:

chmod 700 tmp
setfacl -m "g:www-data:rwx" tmp
setfacl -d -m "g:www-data:rwx" tmp

If neither of above works for you, you can still make the directory chmod 777, but it might impose risk of other users on system reading and writing data in this directory.

警告

Please see top of this chapter (Web 服务器上传/保存/导入目录) for instructions how to setup this directory and how to make its usage secure.

显示设置

$cfg['RepeatCells']
类型:整数
默认值:100

Repeat the headers every X cells, or 0 to deactivate.

$cfg['EditInWindow']
类型:布尔值
默认值:true

4.3.0 版后已移除: 此设置已删除。

$cfg['QueryWindowWidth']
类型:整数
默认值:550

4.3.0 版后已移除: 此设置已删除。

$cfg['QueryWindowHeight']
类型:整数
默认值:310

4.3.0 版后已移除: 此设置已删除。

$cfg['QueryHistoryDB']
类型:布尔值
默认值:false
$cfg['QueryWindowDefTab']
类型:文本
默认值:'sql'

4.3.0 版后已移除: 此设置已删除。

$cfg['QueryHistoryMax']
类型:整数
默认值:25

If $cfg['QueryHistoryDB'] is set to true, all your Queries are logged to a table, which has to be created by you (see $cfg['Servers'][$i]['history']). If set to false, all your queries will be appended to the form, but only as long as your window is opened they remain saved.

When using the JavaScript based query window, it will always get updated when you click on a new table/db to browse and will focus if you click on Edit SQL after using a query. You can suppress updating the query window by checking the box Do not overwrite this query from outside the window below the query textarea. Then you can browse tables/databases in the background without losing the contents of the textarea, so this is especially useful when composing a query with tables you first have to look in. The checkbox will get automatically checked whenever you change the contents of the textarea. Please uncheck the button whenever you definitely want the query window to get updated even though you have made alterations.

If $cfg['QueryHistoryDB'] is set to true you can specify the amount of saved history items using $cfg['QueryHistoryMax'].

$cfg['AllowSharedBookmarks']
类型:布尔值
默认值:true

6.0.0 新版功能.

允许用户创建可供所有其他用户使用的书签

$cfg['BrowseMIME']
类型:布尔值
默认值:true

启用 转换.

$cfg['MaxExactCount']
类型:整数
默认值:50000

For InnoDB tables, determines for how large tables phpMyAdmin should get the exact row count using SELECT COUNT. If the approximate row count as returned by SHOW TABLE STATUS is smaller than this value, SELECT COUNT will be used, otherwise the approximate count will be used.

在 4.8.0 版更改: 由于性能原因,默认值降低至50000。

在 4.2.6 版更改: 默认值已改变为500000。

$cfg['MaxExactCountViews']
类型:整数
默认值:0

For VIEWs, since obtaining the exact count could have an impact on performance, this value is the maximum to be displayed, using a SELECT COUNT ... LIMIT. Setting this to 0 bypasses any row counting.

$cfg['NaturalOrder']
类型:布尔值
默认值:true

Sorts database and table names according to natural order (for example, t1, t2, t10). Currently implemented in the navigation panel and in Database view, for the table list.

$cfg['InitialSlidersState']
类型:文本
默认值:'closed'

If set to 'closed', the visual sliders are initially in a closed state. A value of 'open' does the reverse. To completely disable all visual sliders, use 'disabled'.

$cfg['UserprefsDisallow']
类型:数组
默认值:array()

Contains names of configuration options (keys in $cfg array) that users can’t set through user preferences. For possible values, refer to classes under src/Config/Forms/User/.

$cfg['UserprefsDeveloperTab']
类型:布尔值
默认值:false

3.4.0 新版功能.

Activates in the user preferences a tab containing options for developers of phpMyAdmin.

页面标题

The page title displayed by your browser’s window or tab title bar can be customized. You can use 6.27 我可以使用哪些格式字符串?. The following four options allow customizing various parts of the phpMyAdmin interface. Note that the login page title cannot be changed.

$cfg['TitleTable']
类型:文本
默认值:'@HTTP_HOST@ / @VSERVER@ / @DATABASE@ / @TABLE@ | @PHPMYADMIN@'
$cfg['TitleDatabase']
类型:文本
默认值:'@HTTP_HOST@ / @VSERVER@ / @DATABASE@ | @PHPMYADMIN@'
$cfg['TitleServer']
类型:文本
默认值:'@HTTP_HOST@ / @VSERVER@ | @PHPMYADMIN@'
$cfg['TitleDefault']
类型:文本
默认值:'@HTTP_HOST@ | @PHPMYADMIN@'

主题管理器设置

$cfg['ThemeManager']
类型:布尔值
默认值:true

Enables user-selectable themes. See 2.7 如何创建和使用主题?.

$cfg['ThemeDefault']
类型:文本
默认值:'pmahomme'

The default theme (a subdirectory under ./public/themes/).

$cfg['ThemePerServer']
类型:布尔值
默认值:false

是否允许在每个服务器上使用不同主题。

$cfg['FontSize']
类型:文本
默认值:‘82%’

5.0.0 版后已移除: This setting was removed as the browser is more efficient, thus no need of this option.

使用的字体大小,应用于 CSS。

默认查询

$cfg['DefaultQueryTable']
类型:文本
默认值:'SELECT * FROM @TABLE@ WHERE 1'
$cfg['DefaultQueryDatabase']
类型:文本
默认值:''

在用户没有指定任何查询时,查询框显示的默认查询。你可以参考 6.27 我可以使用哪些格式字符串?

MySQL 设置

$cfg['DefaultFunctions']
类型:数组
默认值:array('FUNC_CHAR' => '', 'FUNC_DATE' => '', 'FUNC_NUMBER' => '', 'FUNC_SPATIAL' => 'GeomFromText', 'FUNC_UUID' => 'UUID', 'first_timestamp' => 'NOW')

Functions selected by default when inserting/changing row, Functions are defined for meta types as (FUNC_NUMBER, FUNC_DATE, FUNC_CHAR, FUNC_SPATIAL, FUNC_UUID) and for first_timestamp, which is used for first timestamp column in table.

示例配置

$cfg['DefaultFunctions'] = [
    'FUNC_CHAR' => '',
    'FUNC_DATE' => '',
    'FUNC_NUMBER' => '',
    'FUNC_SPATIAL' => 'ST_GeomFromText',
    'FUNC_UUID' => 'UUID',
    'first_timestamp' => 'UTC_TIMESTAMP',
];

默认变换选项

$cfg['DefaultTransformations']
类型:数组
默认值:An array with below listed key-values
$cfg['DefaultTransformations']['Substring']
类型:数组
默认值:array(0, ‘all’, ‘…’)
$cfg['DefaultTransformations']['Bool2Text']
类型:数组
默认值:array(‘T’, ‘F’)
$cfg['DefaultTransformations']['External']
类型:数组
默认值:array(0, ‘-f /dev/null -i -wrap -q’, 1, 1)
$cfg['DefaultTransformations']['PreApPend']
类型:数组
默认值:array(‘’, ‘’)
$cfg['DefaultTransformations']['Hex']
类型:数组
默认值:array(‘2’)
$cfg['DefaultTransformations']['DateFormat']
类型:数组
默认值:array(0, ‘’, ‘local’)
$cfg['DefaultTransformations']['Inline']
类型:数组
默认值:array(‘100’, 100)
类型:数组
默认值:array(‘’, 100, 50)
类型:数组
默认值:array(‘’, ‘’, ‘’)

控制台设置

注解

这些配置是最需要用户修改的。

$cfg['Console']['StartHistory']
类型:布尔值
默认值:false

在开始时显示查询历史

$cfg['Console']['AlwaysExpand']
类型:布尔值
默认值:false

总是扩展查询消息

$cfg['Console']['CurrentQuery']
类型:布尔值
默认值:true

显示当前浏览查询

$cfg['Console']['EnterExecutes']
类型:布尔值
默认值:false

使用Enter执行查询,使用Shift+Enter插入新行

$cfg['Console']['DarkTheme']
类型:布尔值
默认值:false

切换到黑色主题

$cfg['Console']['Mode']
类型:文本
默认值:‘info’

控制台模式

$cfg['Console']['Height']
类型:整数
默认值:92

控制台高度

开发

警告

这些设置可能会对性能或安全性产生很大影响。

$cfg['environment']
类型:文本
默认值:'production'

设置工作环境。

仅在使用 phpMyAdmin 开发时才需要修改此选项。 development 模式可能会在一些地方显示调试信息。

可用的值为 'production''development'

$cfg['DBG']
类型:数组
默认值:[]
$cfg['DBG']['sql']
类型:布尔值
默认值:false

Enable logging queries and execution times to be displayed in the console’s Debug SQL tab.

$cfg['DBG']['sqllog']
类型:布尔值
默认值:false

Enable logging of queries and execution times to the syslog. Requires $cfg['DBG']['sql'] to be enabled.

$cfg['DBG']['demo']
类型:布尔值
默认值:false

Enable to let server present itself as demo server. This is used for phpMyAdmin demo server.

目前改变了如下行为:

  • 这是主页的欢迎消息。
  • 这里是有关演示服务器和 Git 修订版的信息。
  • 在已有配置的情况下,安装脚本也会启用。
  • 此安装不会尝试连接至 MySQL 服务器。
$cfg['DBG']['simple2fa']
类型:布尔值
默认值:false

可以使用 简单的双因素身份验证 来测试双因素身份验证。

示例

查看这些 phpMyAdmin 的典型安装配置片断。

基本示例

配置文件的例子,可以复制到 :file:`config.inc.php`来获得一些核心的配置布局;它作为 :file:`config.sample.inc.php`与phpMyAdmin一起分发。请注意,它不包含所有的配置选项,只包含最经常使用的选项。

<?php
/**
 * phpMyAdmin sample configuration, you can use it as base for
 * manual configuration. For easier setup you can use setup/
 *
 * All directives are explained in documentation in the doc/ folder
 * or at <https://docs.phpmyadmin.net/>.
 */

declare(strict_types=1);

/**
 * This is needed for cookie based authentication to encrypt the cookie.
 * Needs to be a 32-bytes long string of random bytes. See FAQ 2.10.
 */
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

/**
 * Servers configuration
 */
$i = 0;

/**
 * First server
 */
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;

/**
 * phpMyAdmin configuration storage settings.
 */

/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
// $cfg['Servers'][$i]['controlport'] = '';
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';

/* Storage database and tables */
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma__relation';
// $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
// $cfg['Servers'][$i]['history'] = 'pma__history';
// $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
// $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
// $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
// $cfg['Servers'][$i]['recent'] = 'pma__recent';
// $cfg['Servers'][$i]['favorite'] = 'pma__favorite';
// $cfg['Servers'][$i]['users'] = 'pma__users';
// $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
// $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
// $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
// $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
// $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
// $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';

/**
 * End of servers configuration
 */

/**
 * Directories for saving/loading files from server
 */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';

/**
 * Whether to display icons or text or both icons and text in table row
 * action segment. Value can be either of 'icons', 'text' or 'both'.
 * default = 'both'
 */
//$cfg['RowActionType'] = 'icons';

/**
 * Defines whether a user should be displayed a "show all (records)"
 * button in browse mode or not.
 * default = false
 */
//$cfg['ShowAll'] = true;

/**
 * Number of rows displayed when browsing a result set. If the result
 * set contains more rows, "Previous" and "Next".
 * Possible values: 25, 50, 100, 250, 500
 * default = 25
 */
//$cfg['MaxRows'] = 50;

/**
 * Disallow editing of binary fields
 * valid values are:
 *   false    allow editing
 *   'blob'   allow editing except for BLOB fields
 *   'noblob' disallow editing except for BLOB fields
 *   'all'    disallow editing
 * default = 'blob'
 */
//$cfg['ProtectBinary'] = false;

/**
 * Default language to use, if not browser-defined or user-defined
 * (you find all languages in the locale folder)
 * uncomment the desired line:
 * default = 'en'
 */
//$cfg['DefaultLang'] = 'en';
//$cfg['DefaultLang'] = 'de';

/**
 * How many columns should be used for table display of a database?
 * (a value larger than 1 results in some information being hidden)
 * default = 1
 */
//$cfg['PropertiesNumColumns'] = 2;

/**
 * Set to true if you want DB-based query history.If false, this utilizes
 * JS-routines to display query history (lost by window close)
 *
 * This requires configuration storage enabled, see above.
 * default = false
 */
//$cfg['QueryHistoryDB'] = true;

/**
 * When using DB-based query history, how many entries should be kept?
 * default = 25
 */
//$cfg['QueryHistoryMax'] = 100;

/**
 * Whether or not to query the user before sending the error report to
 * the phpMyAdmin team when a JavaScript error occurs
 *
 * Available options
 * ('ask' | 'always' | 'never')
 * default = 'ask'
 */
//$cfg['SendErrorReports'] = 'always';

/**
 * 'URLQueryEncryption' defines whether phpMyAdmin will encrypt sensitive data from the URL query string.
 * 'URLQueryEncryptionSecretKey' is a 32 bytes long secret key used to encrypt/decrypt the URL query string.
 */
//$cfg['URLQueryEncryption'] = true;
//$cfg['URLQueryEncryptionSecretKey'] = '';

/**
 * You can find more configuration options in the documentation
 * in the doc/ folder or at <https://docs.phpmyadmin.net/>.
 */

警告

如果控制用户 ‘pma’ 还不存在,不要使用它,也不要使用 ‘pmapass’ 作为密码。

Signon 认证方式示例

This example uses examples/signon.php to demonstrate usage of Signon 认证方式:

<?php
$i = 0;
$i++;
$cfg['Servers'][$i]['auth_type']     = 'signon';
$cfg['Servers'][$i]['SignonSession'] = 'SignonSession';
$cfg['Servers'][$i]['SignonURL']     = 'examples/signon.php';

基于 IP 地址限定的自动登录示例

如果你想在本地访问phpMyAdmin时自动登录,而在远程访问时要求输入密码,你可以用下面的代码片段实现:

if ($_SERVER['REMOTE_ADDR'] === '127.0.0.1') {
    $cfg['Servers'][$i]['auth_type'] = 'config';
    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['password'] = 'yourpassword';
} else {
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
}

注解

基于 IP 地址的过滤器在互联网上不太可靠,请仅针对本地地址使用。

使用多台 MySQL 服务器的例子

You can configure any number of servers using $cfg['Servers'], following example shows two of them:

<?php
// The string is a hexadecimal representation of a 32-bytes long string of random bytes.
$cfg['blowfish_secret'] = sodium_hex2bin('f16ce59f45714194371b48fe362072dc3b019da7861558cd4ad29e4d6fb13851');
$i = 0;

$i++; // server 1 :
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['verbose']   = 'no1';
$cfg['Servers'][$i]['host']      = 'localhost';
// more options for #1 ...

$i++; // server 2 :
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['verbose']   = 'no2';
$cfg['Servers'][$i]['host']      = 'remote.host.addr';//or ip:'10.9.8.1'
// this server must allow remote clients, e.g., host 10.9.8.%
// not only in mysql.host but also in the startup configuration
// more options for #2 ...

// end of server sections
$cfg['ServerDefault'] = 0; // to choose the server on startup

// further general options ...

使用 SSL 的 Google Cloud SQL

To connect to Google Could SQL, you currently need to disable certificate verification. This is caused by the certificate being issued for CN matching your instance name, but you connect to an IP address and PHP tries to match these two. With verification you end up with error message like:

Peer certificate CN=`api-project-851612429544:pmatest' did not match expected CN=`8.8.8.8'

警告

With disabled verification your traffic is encrypted, but you’re open to man in the middle attacks.

To connect phpMyAdmin to Google Cloud SQL using SSL download the client and server certificates and tell phpMyAdmin to use them:

// IP address of your instance
$cfg['Servers'][$i]['host'] = '8.8.8.8';
// Use SSL for connection
$cfg['Servers'][$i]['ssl'] = true;
// Client secret key
$cfg['Servers'][$i]['ssl_key'] = '../client-key.pem';
// Client certificate
$cfg['Servers'][$i]['ssl_cert'] = '../client-cert.pem';
// Server certification authority
$cfg['Servers'][$i]['ssl_ca'] = '../server-ca.pem';
// Disable SSL verification (see above note)
$cfg['Servers'][$i]['ssl_verify'] = false;

Amazon RDS Aurora with SSL

To connect phpMyAdmin to an Amazon RDS Aurora MySQL database instance using SSL, download the CA server certificate and tell phpMyAdmin to use it:

// Address of your instance
$cfg['Servers'][$i]['host'] = 'replace-me-cluster-name.cluster-replace-me-id.replace-me-region.rds.amazonaws.com';
// Use SSL for connection
$cfg['Servers'][$i]['ssl'] = true;
// You need to have the region CA file and the authority CA file (2019 edition CA for example) in the PEM bundle for it to work
$cfg['Servers'][$i]['ssl_ca'] = '../rds-combined-ca-bundle.pem';
// Enable SSL verification
$cfg['Servers'][$i]['ssl_verify'] = true;

reCaptcha using hCaptcha

$cfg['CaptchaApi'] = 'https://www.hcaptcha.com/1/api.js';
$cfg['CaptchaCsp'] = 'https://hcaptcha.com https://*.hcaptcha.com';
$cfg['CaptchaRequestParam'] = 'h-captcha';
$cfg['CaptchaResponseParam'] = 'h-captcha-response';
$cfg['CaptchaSiteVerifyURL'] = 'https://hcaptcha.com/siteverify';
// This is the secret key from hCaptcha dashboard
$cfg['CaptchaLoginPrivateKey'] = '0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
// This is the site key from hCaptcha dashboard
$cfg['CaptchaLoginPublicKey'] = 'xxx-xxx-xxx-xxx-xxxx';

reCaptcha using Turnstile

$cfg['CaptchaMethod'] = 'checkbox';
$cfg['CaptchaApi'] = 'https://challenges.cloudflare.com/turnstile/v0/api.js';
$cfg['CaptchaCsp'] = 'https://challenges.cloudflare.com https://static.cloudflareinsights.com';
$cfg['CaptchaRequestParam'] = 'cf-turnstile';
$cfg['CaptchaResponseParam'] = 'cf-turnstile-response';
$cfg['CaptchaLoginPublicKey'] = '0xxxxxxxxxxxxxxxxxxxxxx';
$cfg['CaptchaLoginPrivateKey'] = '0x4AAAAAAAA_xx_xxxxxxxxxxxxxxxxxxxx';
$cfg['CaptchaSiteVerifyURL'] = 'https://challenges.cloudflare.com/turnstile/v0/siteverify';

reCaptcha using Google reCaptcha v2/v3

$cfg['CaptchaLoginPublicKey'] = 'xxxxxxxxxxxxxxxx-xxxxxxxxxxxx';
$cfg['CaptchaLoginPrivateKey'] = 'xxxxxxxxx-xxxxxxxxxxxxxx';
// Remove it if you dot not want the checkbox mode
$cfg['CaptchaMethod'] = 'checkbox';