这是一份 phpMyAdmin 文档的翻译。你可以到翻译服务器来帮助我们完善它。

环境需求

介绍

在有超级用户的情况下,phpMyAdmin 可以像管理一个数据库一样管理整个 MySQL 服务器。要实现这些功能你需要正确设置 MySQL 用户能够读/写的数据库。你可以在 MySQL 手册中找到相关内容。

目前 phpMyAdmin 具有的功能有:

关于用户:

很多人难以理解 phpMyAdmin 用户的概念。当一个用户登录到 phpMyAdmin 的时候,用户名和密码是被直接发送到 MySQL 的。phpMyAdmin 本身并没有任何用户管理行为 (有 MySQL 管理权限的用户可以通过 phpMyAdmin 管理其他的 MySQL 用户),所有用户必须是有效的 MySQL 用户。

1) 若 PHP 有 zlib (--with-zlib) 和/或 bzip2 (--with-bz2) 扩展 (可能还需要修改 php.ini)。phpMyAdmin 在转储和导出 CSV 时可压缩成 (zip、gzip -RFC 1952- 或 bzip2 格式)。

安装

  1. 快速安装
  2. 使用安装脚本
  3. phpMyAdmin configuration storage
  4. 从旧版本升级
  5. 使用认证

phpMyAdmin 不会在 MySQL 数据库服务器上应用任何特殊的安全措施。正确设置 MySQL 数据库的权限是系统管理员应该做的。phpMyAdmin 的 "权限" 页面可以帮助系统管理员设置权限。

Mac 用户注意:
如果你使用的 Mac OS 版本低于 OS X,StuffIt 会把文件解压成 Mac 格式。
因为 PHP 好像不支持 Mac 式的换行符 ("\r"),所以在上传到服务器之前,你必须把所有 phpMyAdmin 脚本用 BBEdit 重新保存为 Unix 格式。

快速安装

  1. 从 phpmyadmin.net 下载页选择一个合适的版本。有些版本只有英语,有些只使用 UTF-8 编码且包含了所有语言 (适用于大多数情况),还有些包含了所有语言和所有编码。现在我们假设你选择的是一个像 phpMyAdmin-x.x.x-all-languages.tar.gz 这样名字的版本。
  2. 解开这个压缩包 (连同子目录一起解压): 在你网站服务器的文档根目录执行 tar -xzvf phpMyAdmin_x.x.x-all-languages.tar.gz 。如果你没有直接的访问服务器的权限,先把这些文件解压到你自己的电脑上,等完成第 4 步之后,再通过 ftp 等方式上传到你的网站服务器上。
  3. 确保所有的脚本都有正确的所有者 (如果 PHP 运行于安全模式,所有者的不同可能会导致问题)。参见 FAQ 4.2FAQ 1.26
  4. 现在你需要做一些设置。通常我们会手动编辑一份 config.inc.php 的副本,但现在我们为那些喜欢使用图形界面安装的用户提供了一个向导式的安装脚本。手动创建 config.inc.php 仍然是一个快速安装的方法,而且一些高级功能也需要手动编辑。
    • 要手动创建 config.inc.php,首先你要有一个文本编辑器 (你可以复制 phpMyAdmin 主目录 (顶层,包含 index.php 的目录) 的 config.sample.inc.php 获得包含最小配置的配置文件。phpMyAdmin 首先会加载 libraries/config.default.php 中的默认设置,然后再用 config.inc.php 中的设置覆盖。如果默认值就是你所需要的,那就不用在 config.inc.php 里面再写一遍了。一个简单的设置如下:
      <?php
      $cfg['blowfish_secret'] = 'ba17c1ec07d65003';  // 此值可任意修改
      
      $i=0;
      $i++;
      $cfg['Servers'][$i]['auth_type']     = 'cookie';
      ?>
      
      或者,如果你不想每次都登录:
      <?php
      
      $i=0;
      $i++;
      $cfg['Servers'][$i]['user']          = 'root';
      $cfg['Servers'][$i]['password']      = 'cbb74bc'; // 这里填写你的密码
      $cfg['Servers'][$i]['auth_type']     = 'config';
      ?>
      
      完整的设置说明请参见本文档的 设置 一节。
    • 不想手动编辑 config.inc.php 的话,你可以使用 安装脚本 来代替。为了安全,首先你要在 phpMyAdmin 目录下创建一个 config 文件夹。在 Linux/Unix 系统上你可以使用以下命令:
      cd phpMyAdmin
      mkdir config                        # 创建保存配置文件的目录
      chmod o+rw config                   # 授予所有人对这个目录的写入权限
      
      如果要修改一个现有的配置文件,先将其复制到目录中:
      cp config.inc.php config/           # 复制当前的配置文件以编辑
      chmod o+w config/config.inc.php     # 授予所有人对这个文件的写入权限
      
      在其他平台上, 创建目录并确保网站服务器可以读写即可。参见 FAQ 1.26

      接下来,在浏览器中打开 setup/。要注意的是,在点 设置 区域的 保存之前,所有修改不会被保存。通常安装脚本都可以保存新的 config.inc.php 到 config/ 目录,但在有些权限不正确的服务器上你会看到 "无法加载或保存配置" 的错误提示。请确保 config/ 目录存在并有正确的权限,或使用 下载 把配置文件下载下来再通过 FTP 等方式上传到正确的位置。

      为了安全,在保存之后,就要把配置文件移出 config/ 目录并且重新设置权限:
      mv config/config.inc.php .         # 移动配置文件到当前目录
      chmod o-rw config.inc.php          # 撤销所有人对配置文件的读写权限
      rm -rf config                      # 删除不需要的目录
      
      现在配置文件保存好了。如果你要检查当前设置或者要设置一些安装脚本中没有提供的高级功能,你可以用你最喜欢的编辑器来编辑它。
  5. 如果使用 "config" 认证,你应该保护好 phpMyAdmin 的安装目录,因为 config 认证不会要求用户输入密码。我们建议使用其他认证,如在 .htaccess 文件中设置 HTTP 认证或修改设置让 phpMyAdmin 使用 cookie/http 认证。更多信息参见 FAQ 中的 多用户 一节,特别要注意 FAQ 4.4 中所提到的问题。
  6. 在浏览器中打开 phpMyAdmin 主目录。现在 phpMyAdmin 应该显示一个欢迎页面和你的数据库,如果使用 HTTP 或 cookie 认证,则将显示一个登录对话框。
  7. 你应该在你的网站服务器中设置禁止对 ./libraries./setup/lib 这两个子目录的访问。在 Apache 中你可以通过 .htaccess 文件设置,其他网站服务器请自行设置。通过设置来预防可能的路径泄露以及跨占脚本攻击,加强服务器的安全性。
  8. 禁止搜索引擎访问公开的 phpMyAdmin 是个好方法,因为这对它们没有任何用处。你可以使用网站服务器根目录的 robots.txt 文件或直接从网站服务器设置中限制其访问。你可以在 contrib 目录下找到 .htaccess 文件的范例。

phpMyAdmin configuration storage

For a whole set of new features (bookmarks, comments, SQL-history, tracking mechanism, PDF-generation, column contents transformation, etc.) you need to create a set of special tables. Those tables can be located in your own database, or in a central database for a multi-user installation (this database would then be accessed by the controluser, so no other user should have rights to it).

你可以在 ./scripts/ 目录下找到 create_tables.sql 文件 (如果你使用的是 Windows 服务器,请特别注意在 FAQ 1.23 中所提到的问题)。

If you already had this infrastructure and upgraded to MySQL 4.1.2 or newer, please use ./scripts/upgrade_tables_mysql_4_1_2+.sql and then create new tables by importing ./scripts/create_tables.sql.

你可以使用 phpMyAdmin 来创建这些数据表。但请注意,你可能需要特殊 (管理员) 权限来创建数据库和数据表,而且可能还需要根据实际所使用的数据修改这个脚本中数据库的名字。

在导入 ./scripts/create_tables.sql 文件之后,就可以根据数据表的名字修改 ./config.inc.php 配置文件。需要使用到的配置可以在 设置 一节中找到。同时还要有一个在那些表上具有相应权限的控制用户 (参见下面的 使用认证 一节)。

从旧版本升级

只需复制旧版本的 ./config.inc.php 到新版本即可。当某些选项被改变或取消时,也可能需要做一些修改,特别是 $cfg['AttributeTypes'] 的定义被修改了,所以你最好将它从你的配置文件中删除,使用默认值。为了兼容 PHP 6,还需要删除可能出现在配置文件的末尾的 set_magic_quotes_runtime(0); 语句。

请勿复制 libraries/config.default.phpconfig.inc.php 因为默认配置是仅对当前版本有效的。

If you have upgraded your MySQL server from a version previous to 4.1.2 to version 5.x or newer and if you use the phpMyAdmin configuration storage, you should run the SQL script found in scripts/upgrade_tables_mysql_4_1_2+.sql.

使用认证

'HTTP' 认证

'cookie' 认证

'signon' 认证

'config' 认证

Swekey 认证

Swekey 是可用于网站应用程序上的廉价 USB 证书。

当开启 Swekey 认证时,需要在进入 phpMyAdmin 的登录页面前插入 Swekey (目前仅支持 cookie 认证)。Swekey 认证默认为关闭。

config.inc.php 中添加如下内容可启用 Swekey 认证:

$cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey.conf';

然后你要创建用来保存每个用户 Swekey 标识的文件 swekey.conf 。这个文件不应该放在网站服务器的文档根目录 (在例子中,我们把它放在了 /etc) 。在 contrib 目录下可以找到一个带有说明的范例文件。欢迎使用你自己的用户信息。

如果你想购买 Swekey 请访问 http://phpmyadmin.net/auth_key (外链,英语),通过此链接购买 phpMyAdmin 将会得到捐助。

设置

Mac 用户注意: PHP 似乎不支持 Mac 式的换行符 ("\r")。所以在保存你所修改的文件之前,请确保你的文本编辑器使用 *nix 式的换行符 ("\n")。

注意: 几乎所有设置都在 config.inc.php 文件中定义。如果此文件不存在,请参考快速安装一节创建该文件。你只需要设置不同于 libraries/config.default.php 中所定义的默认值的设置。

与设计相关的参数 (如颜色) 是通过 themes/主题名/layout.inc.php 定义的。你可能还需要创建 config.footer.inc.phpconfig.header.inc.php 文件用来添加你的代码到每一页的页眉和页脚。

$cfg['PmaAbsoluteUri'] 字符串
在这里设置 phpMyAdmin 安装目录的完整 URL 。如, http://www.your_web.net/path_to_your_phpMyAdmin_directory/ 。注意在有些网站服务器上 URL 是区分大小写的。不要忘了最后的斜杠。

自 2.3.0 起,我们建议将本设置留空。大多数情况下 phpMyAdmin 能正确地自动识别。使用端口转发的用户需要设置 PmaAbsoluteUri (详细信息 (外链,英语))。通过浏览一张数据表、编辑并保存一条记录可以测试出自动识别是否有问题。如果有问题 phpMyAdmin 会有错误信息。如果你收到了必须设置或自动识别失败的错误,请给我们提交一份缺陷 (bug) 报告以便我们能改进这个功能。
$cfg['PmaNoRelation_DisableWarning'] 布尔
自 2.3.0 起 phpMyAdmin 提供了一系列关于主/外表的功能 (参见 $cfg['Servers'][$i]['pmadb'])。
如果你尝试使用这些功能但无法正常使用,请在你想使用该功能的数据库中打开"结构"页。你会看到一个可以告诉你为什么这些功能无法使用的链接。
如果你不想使用那些功能,将此值设为 TRUE 即可隐藏那些提示信息。
$cfg['SuhosinDisableWarning'] 布尔
设为 TRUE 可在检测到 Suhosin 时不显示警告。
$cfg['McryptDisableWarning'] 布尔
设为 TRUE 可在使用 cookie 认证但没有 mcrypt 扩展时不显示警告。
$cfg['AllowThirdPartyFraming'] 布尔
设为 true 将允许 phpMyAdmin 被不同域名的框架所调用,这个潜在的安全漏洞可能导致跨框架脚本攻击。
$cfg['blowfish_secret'] 字符串
"cookie" 认证使用 blowfish 算法加密用户的密码。
若要使用 "cookie" 认证,需要设置一个随机的密钥。这是 blowfish 算法内部使用的,以后也不会向你询问。字数不限。

自 3.1.0 起 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'][$i]['host'] 字符串
第 $i 个 MySQL 服务器的主机名或 IP 地址。如 localhost 。
$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]['ssl'] 布尔
设置连接到 MySQL 服务器时是否使用 SSL 安全连接。
$cfg['Servers'][$i]['connect_type'] 字符串
设置怎样连接到 MySQL 服务器。可选 'socket''tcp' 。默认为 'tcp',所有 MySQL 服务器都可以使用,而套接字在有些平台上不可用。

要使用套接字连接,MySQL 服务器必须和网站服务器在同一台服务器上。
$cfg['Servers'][$i]['extension'] 字符串
设置使用什么 PHP 扩展连接到 MySQL。可供选择的有:

mysql : 经典 MySQL 扩展。目前推荐以及默认的扩展。

mysqli : 改进的 MySQL 扩展。该扩展自 PHP 5.0.0 起可用,并且推荐用于连接到 4.1.x 或更高版本的 MySQL 。
$cfg['Servers'][$i]['compress'] 布尔
设置是否使用压缩协议连接到 MySQL 服务器 (试验性的)。
此功能需要 PHP 4.3.0 或更高版本。
$cfg['Servers'][$i]['controluser'] 字符串
$cfg['Servers'][$i]['controlpass'] 字符串
This special account is used for 2 distinct purposes: to make possible all relational features (see $cfg['Servers'][$i]['pmadb']) and, for a MySQL server running with --skip-show-database, to enable a multi-user installation (HTTP or cookie authentication mode).

当使用 HTTP 或 cookie 认证时 (自 2.2.1 起也包括 'config' 认证),你需要提供一个在 mysql.user (除了 "Password" 之外的所有字段)mysql.db (所有字段)mysql.tables_priv (除了 "Grantor" 和 "Timestamp" 之外的所有字段) 表上具有 SELECT 权限的 MySQL 帐号,以便检查用户可以看到哪些数据库。
详细信息请参见安装一节中的"使用认证"。

在 2.2.5 前,这两个设置名分别为 "stduser/stdpass" 。
$cfg['Servers'][$i]['auth_type'] 字符串 ['HTTP'|'http'|'cookie'|'config'|'signon']
设置服务器使用 config、cookie、HTTP 还是 signon 认证。
  • 'config' 认证 ($auth_type = 'config') 是最经典的方法: 用户名和密码被保存在 config.inc.php 中。
  • 'cookie' 认证 ($auth_type = 'cookie') 自 2.2.3 起允许在 cookies 的支持下使用任意有效的 MySQL 用户登录。会话中的用户名和密码被保存在 cookies 中,会话结束后密码将被删除。若启用 $cfg['AllowArbitraryServer'] 则可登录到任意服务器。
  • 'HTTP' 认证 (旧版本中曾被称为 'advanced' 认证,也可写作 'http') ($auth_type = 'HTTP') 自 1.3.0 起允许通过任意有效的 MySQL 用户登录。
  • 'signon' 认证 ($auth_type = 'signon') 自 2.10.0 起允许通过预定义的 PHP 会话数据登录。这在通过单点登录整合第三方应用程序时很有用。这个文件演示了如何记录 signon 的会话: scripts/signon.php,你还需要设置会话名登录 URL
详细信息请参见安装一节中的"使用认证"。
$cfg['Servers'][$i]['auth_http_realm'] 复制
当使用 'HTTP' 时,可通过本设置自定义在要求 HTTP 基本认证时用户所收到的提示信息。若未设置,将使用 "phpMyAdmin " 与 $cfg['Servers'][$i]['verbose']$cfg['Servers'][$i]['host'] 作为提示信息。
$cfg['Servers'][$i]['auth_swekey_config'] 字符串
包含用于硬件认证的 Swekey 标识和登录名的文件名。不使用请留空。
$cfg['Servers'][$i]['user'] 字符串
$cfg['Servers'][$i]['password'] 字符串
使用 'config' 认证时用来连接到 MySQL 服务器的用户名和密码。使用 HTTP 或 cookie 认证时请留空,不需要填写。
$cfg['Servers'][$i]['nopassword'] 布尔
设置使用密码登录失败时是否允许尝试使用空密码登录。可与 http 认证同时使用,或通过其他方式完成认证使得 phpMyAdmin 取得用户名及空密码来连接到 MySQL 。然而总是会先尝试使用密码登录的。
$cfg['Servers'][$i]['only_db'] 字符串 或 数组
设置一个 (或一组) 数据库名,用户只能看到这些数据库。自 2.2.1 起,数据库名可以包含 MySQL 通配符 ("_" 和 "%"): 如果你想使用这些字符本身,请转义它们 (即: 要使用 'my\_db' 来表示 'my_db')。
此设置可有效降低服务器的负载,因为不需要向 MySQL 发送构建可用数据库列表的请求。但它并不能取代 MySQL 数据库服务器的权限规则。这仅意味着这些数据库被显示出来而已,而不是说没有显示出来的数据库都不能用。

设置使用多个数据库的例子: $cfg['Servers'][$i]['only_db'] = array('数据库名1', '数据库名2');

自 2.5.5 起,数组中所列出数据库的顺序也被用于在左侧框架排序,所以你可以用它来设置数据库显示的顺序。
若希望让部分数据库置顶显示,不需要列出所有数据库,用: $cfg['Servers'][$i]['only_db'] = array('要置顶的数据库1', '要置顶的数据库2', '*'); 即可,phpMyAdmin 就会将 要置顶的数据库1 和 要置顶的数据库2 置顶显示,而其他数据库还按字母顺序排列。
$cfg['Servers'][$i]['hide_db'] 字符串
隐藏数据库的正则表达式。这仅仅将数据库从列表中隐藏,用户仍然可以直接访问 (如通过 SQL 查询)。要彻底限制访问,请使用 MySQL 权限系统。

例如,要隐藏所有以字母 "a" 开头的数据库,用
$cfg['Servers'][$i]['hide_db'] = '^a';
要隐藏数据库 "数据库1" 和 "数据库2" ,用
$cfg['Servers'][$i]['hide_db'] = '^(db1|db2)$';
可以在 PHP 手册的 Perl 兼容正则表达式的语法 (外链,英语) 一节中找到更多关于正则表达式的信息。
$cfg['Servers'][$i]['verbose'] 字符串
仅在通过 phpMyAdmin 管理多个服务器时有用。主页的下拉菜单中将用此值代替主机名。如果你想只显示系统中部分数据库时也有用,如,使用 HTTP 认证时,所有非 ASCII 字符都将被删除。
$cfg['Servers'][$i]['pmadb'] 字符串
The name of the database containing the phpMyAdmin configuration storage.

See the phpMyAdmin configuration storage section in this document to see the benefits of this feature, and for a quick way of creating this database and the needed tables.

If you are the only user of this phpMyAdmin installation, you can use your current database to store those special tables; in this case, just put your current database name in $cfg['Servers'][$i]['pmadb']. For a multi-user installation, set this parameter to the name of your central database containing the phpMyAdmin configuration storage.
$cfg['Servers'][$i]['bookmarktable'] 字符串
自 2.2.0 起 phpMyAdmin 允许用户将查询加入书签。你可以将经常要执行的语句加入书签。

要启用此功能:
  • set up pmadb and the phpMyAdmin configuration storage
  • $cfg['Servers'][$i]['bookmarktable'] 中设置要使用的数据表名
$cfg['Servers'][$i]['relation'] 字符串
Since release 2.2.4 you can describe, in a special 'relation' table, which column is a key in another table (a foreign key). phpMyAdmin currently uses this to
  • 使外键数据可点击,浏览主表时可通过点击数据值转到外表;
  • display in an optional tool-tip the "display column" when browsing the master table, if you move the mouse to a column containing a foreign key (use also the 'table_info' table);
    (参见 FAQ 6.7)
  • in edit/insert mode, display a drop-down list of possible foreign keys (key value and "display column" are shown)
    (参见 FAQ 6.21)
  • display links on the table properties page, to check referential integrity (display missing foreign keys) for each described key;
  • 通过依例查询自动创建关联查询 (参见 FAQ 6.6)
  • 生成 PDF 格式的数据库大纲 (需同时使用 table_coords 表)。
字段值可以是数字或者字符。

要启用此功能:
  • set up pmadb and the phpMyAdmin configuration storage
  • $cfg['Servers'][$i]['relation'] 中设置要使用的数据表名
  • now as normal user open phpMyAdmin and for each one of your tables where you want to use this feature, click "Structure/Relation view/" and choose foreign columns.
Please note that in the current version, master_db must be the same as foreign_db. Those columns have been put in future development of the cross-db relations.
$cfg['Servers'][$i]['table_info'] 字符串
Since release 2.3.0 you can describe, in a special 'table_info' table, which column is to be displayed as a tool-tip when moving the cursor over the corresponding key.
这张表的名字将被保存在此变量中。要启用此功能:
  • set up pmadb and the phpMyAdmin configuration storage
  • put the table name in $cfg['Servers'][$i]['table_info'] (e.g. 'pma_table_info')
  • then for each table where you want to use this feature, click "Structure/Relation view/Choose column to display" to choose the column.
Usage tip: Display column.
$cfg['Servers'][$i]['table_coords'] 字符串
$cfg['Servers'][$i]['pdf_pages'] 字符串
自 2.3.0 起你可以用 phpMyAdmin 创建 PDF 页面来显示各数据表之间的关系。要实现这个功能需要两张数据表,"pdf_pages" (保存可用 PDF 页的信息) 和 "table_coords" (保存每张表在 PDF 大纲输出中的坐标)。

需要 "relation" 功能支持。

要启用此功能:
  • set up pmadb and the phpMyAdmin configuration storage
  • $cfg['Servers'][$i]['table_coords']$cfg['Servers'][$i]['pdf_pages'] 中设置要使用的数据表名
使用技巧: PDF 输出
$cfg['Servers'][$i]['column_info'] 字符串
自 2.3.0 起可以为每张数据表保存每个字段的注释。"打印预览"会用到此功能。

Starting with release 2.5.0, comments are consequently used on the table property pages and table browse view, showing up as tool-tips above the column name (properties page) or embedded within the header of table in browse view. They can also be shown in a table dump. Please see the relevant configuration directives later on.

Also new in release 2.5.0 is a MIME-transformation system which is also based on the following table structure. See Transformations for further information. To use the MIME-transformation system, your column_info table has to have the three new columns 'mimetype', 'transformation', 'transformation_options'.

要启用此功能:
  • set up pmadb and the phpMyAdmin configuration storage
  • put the table name in $cfg['Servers'][$i]['column_info'] (e.g. 'pma_column_info')
  • 要从 2.5.0 之前的 Column_comments 表升级可执行:
    ALTER TABLE `pma_column_comments`
        ADD `mimetype` VARCHAR( 255 ) NOT NULL,
        ADD `transformation` VARCHAR( 255 ) NOT NULL,
        ADD `transformation_options` VARCHAR( 255 ) NOT NULL;
    
    别忘了将 config.inc.php 中的
    $cfg['Servers'][$i]['column_comments'] 改为 $cfg['Servers'][$i]['column_info']
$cfg['Servers'][$i]['history'] 字符串
自 2.5.0 起可以保存你在 phpMyAdmin 中输入的 SQL 查询历史。如果你不想使用基于数据表的历史记录,也可以使用基于 JavaScript 的历史记录。但当你关闭窗口时,所有历史记录都将被删除。

通过 $cfg['QueryHistoryMax'] 可以定义保存历史记录的最大数量。过量历史记录的删除操作将在每次登录时执行。

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

要启用此功能:
  • set up pmadb and the phpMyAdmin configuration storage
  • put the table name in $cfg['Servers'][$i]['history'] (e.g. 'pma_history')
$cfg['Servers'][$i]['tracking'] 字符串
自 3.3.x 起可以使用追踪功能。它可以帮你追踪每个通过 phpMyAdmin 执行的 SQL 命令。它支持记录数据修改和数据定义语句。启用后还可以创建数据表的版本。

创建版本会造成两个影响:
  • phpMyAdmin 保存当前数据表的快照,包括结构和索引。
  • phpMyAdmin 针对当前数据表记录的所有修改结构和/或数据的命令都将与版本关联。
当然你也能查看追踪到的修改。在"追踪"页里每个版本都会有一份完整的报告。你可以在报告中搜索,如你可以只列出一段时间内的语句。若想根据用户名搜索可以输入 * 表示任意用户或者输入 ',' 分隔的用户列表。你还可以导出 (包括搜索结果) 报告为文件或者临时数据库。

要启用此功能:
  • set up pmadb and the phpMyAdmin configuration storage
  • put the table name in $cfg['Servers'][$i]['tracking'] (e.g. 'pma_tracking')
$cfg['Servers'][$i]['tracking_version_auto_create'] boolean
设置追踪系统是否自动为数据表和视图创建版本。默认为 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'] boolean
Whether a DROP VIEW IF EXISTS statement will be added as first line to the log when creating a view. Default value is true.

$cfg['Servers'][$i]['tracking_add_drop_table'] boolean
Whether a DROP TABLE IF EXISTS statement will be added as first line to the log when creating a table. Default value is true.

$cfg['Servers'][$i]['tracking_add_drop_database'] boolean
Whether a DROP DATABASE IF EXISTS statement will be added as first line to the log when creating a database. Default value is true.

$cfg['Servers'][$i]['userconfig'] string
Since release 3.4.x phpMyAdmin allows users to set most preferences by themselves and store them in the database.

If you don't allow for storing preferences in pmadb, users can still personalize phpMyAdmin, but settings will be saved in browser's local storage, or, it is is unavailable, until the end of session.

要启用此功能:
  • set up pmadb and the phpMyAdmin configuration storage
  • put the table name in $cfg['Servers'][$i]['userconfig']
$cfg['Servers'][$i]['designer_coords'] 字符串
自 2.10.0 起可以通过设计器可视化地管理关系。

要启用此功能:
  • set up pmadb and the phpMyAdmin configuration storage
  • put the table name in $cfg['Servers'][$i]['designer_coords'] (e.g. 'pma_designer_coords')
$cfg['Servers'][$i]['verbose_check'] 布尔
Because release 2.5.0 introduced the new MIME-transformation support, the column_info table got enhanced with three new columns. If the above variable is set to TRUE (default) phpMyAdmin will check if you have the latest table structure available. If not, it will emit a warning to the superuser.

你可以通过将其设为 false 来禁止此检查,从而得到性能的提升。

当你确定你的表结构是最新的时,我们建议将其设为 FALSE 。
$cfg['Servers'][$i]['AllowRoot'] 布尔
设置是否允许 root 用户访问。此为以下 AllowDeny rules 的快速设置。
$cfg['Servers'][$i]['AllowNoPassword'] 布尔
设置是否允许使用空密码登录。为了防止可能存在空密码的 root 或者其他匿名 (空) 用户访问到 MySQL 服务器,此项默认为 false
$cfg['Servers'][$i]['AllowDeny']['order'] 字符串
If your rule order is empty, then IP authorization is disabled.

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

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

If your rule order is set to 'explicit', authorization is performed in a similar fashion to rule order 'deny,allow', with the added restriction that your host/username combination must be listed in the allow rules, and not listed in the deny rules. This is the most secure means of using Allow/Deny rules, and was available in Apache by specifying allow and deny rules without setting any order.

同时请参见 $cfg['TrustedProxies'] 探测使用代理的真实 IP 。
$cfg['Servers'][$i]['AllowDeny']['rules'] 数组 或 字符串
规则的格式通常为:
<'allow' | 'deny'> <用户名> [from] <IP 地址掩码>
如果要匹配所有用户,请在用户名一栏中使用通配符 '%'
有几个 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 (一个具体的 IP 地址)
xxx.xxx.xxx.[yyy-zzz] (一段 IP 地址范围)
xxx.xxx.xxx.xxx/nn (CIDR,无类别域间路由类型的 IP 地址范围)
而下列形式是无效的:
xxx.xxx.xxx.xx[yyy-zzz] (部分 IP 地址范围)
也不支持互联网协议第六版 (IPv6) 的地址。
$cfg['Servers'][$i]['DisableIS'] 布尔
设置是否禁止通过 INFORMATION_SCHEMA 来获取信息 (用 SHOW 命令代替),若不禁止且数据库很多时可能会造成性能下降。目前仅部分代码实现此功能,持续增加中。
$cfg['Servers'][$i]['ShowDatabasesCommand'] 字符串
在有相当数量数据库的服务器上,通过默认的 SHOW DATABASES 命令来查询可用数据库的名字可能会很慢,你可以用更快的命令来代替它 (参见 libraries/config.default.php 文件中的例子)。
$cfg['Servers'][$i]['CountTables'] 布尔
设置是否在导航框架的数据库列表中显示每个数据库中数据表的总数。
$cfg['Servers'][$i]['SignonSession'] 字符串
signon 认证所用的会话名。
$cfg['Servers'][$i]['SignonURL'] 字符串
使用 signon 认证时用户将转到登录的 URL 。应为包含协议的绝对地址。
$cfg['Servers'][$i]['LogoutURL'] 字符串
使用 signon 认证时用户退出后将转到的 URL (config 认证无效)。应为包含协议的绝对地址。
$cfg['ServerDefault'] 整数
如果有多个服务器设置,你可以设置 $cfg['ServerDefault'] 为其中之一,phpMyAdmin 将会自动连接,若设为 0 则将在登录页面显示服务器列表。
如果只有一个服务器设置,$cfg['ServerDefault'] 必须设为那台服务器。
$cfg['MaxDbList'] 整数
导航框架和数据库列表中所显示数据库的最大数量。
$cfg['MaxTableList'] 整数
轻量级模式导航框架和主框架列表 (除导出页) 中所显示数据表的最大数量。
$cfg['MaxCharactersInDisplayedSQL'] 整数
显示 SQL 查询的最大字数。默认值 1000 通常可以避免 BLOB 字段中十六进制内容的显示,但有些用户确实有超过 1000 字的 SQL 查询。另外,如果一个查询超过了这个限制,也将不会保存在查询历史中。
$cfg['OBGzip'] 字符串/布尔
设置是否使用 GZip 压缩输出缓冲来加速 HTTP 传输。
设为 true/false 以启/禁用。当设为 'auto' (字符串) 时,phpMyAdmin 将尝试启用输出缓冲并在浏览器对缓冲支持有问题时自动禁用。已知具有特定补丁的 IE6 会在启用缓冲时导致数据损坏。
$cfg['PersistentConnections'] 布尔
设置是否使用持久连接 (mysql_connect 还是 mysql_pconnect) 。
$cfg['ForceSSL'] 布尔
设置在访问 phpMyAdmin 时是否强制使用 https 安全连接。
$cfg['ExecTimeLimit'] 整数 [单位: 秒]
设置脚本可以运行的时间。若设为 0 则无限制。
本设置用于导入/导出转储文件以及同步功能中,若 PHP 运行于安全模式则无效。
$cfg['SessionSavePath'] 字符串
保存会话数据的路径 (PHP 参数 session_save_path (外链,英语))。
$cfg['MemoryLimit'] string [number of bytes]
设置脚本运行的可使用的内存。若设为 0 则无限制。
本设置用于导入/导出转储文件以及 phpMyAdmin 的其他功能,所以显然不要设置一个很小的值。若 PHP 运行于安全模式则无效。
同样可以设置为 php.ini 中可以识别的字符串,如 '16M' 。请确保没有丢掉后缀 (16 表示 16 字节!)
$cfg['SkipLockedTables'] 布尔
Mark used tables and make it possible to show databases with locked tables (since MySQL 3.23.30).
$cfg['ShowSQL'] boolean
Defines whether SQL queries generated by phpMyAdmin should be displayed or not.
$cfg['AllowUserDropDatabase'] boolean
Defines whether normal users (non-administrator) are allowed to delete their own database or not. If set as FALSE, the link "Drop Database" will not be shown, and even a "DROP DATABASE mydatabase" will be rejected. Quite practical for ISP's with many customers.
Please note that this limitation of SQL queries is not as strict as when using MySQL privileges. This is due to nature of SQL queries which might be quite complicated. So this choice should be viewed as help to avoid accidental dropping rather than strict privilege limitation.
$cfg['Confirm'] boolean
Whether a warning ("Are your really sure...") should be displayed when you're about to lose data.
$cfg['LoginCookieRecall'] boolean
Define whether the previous login should be recalled or not in cookie authentication mode.

This is automatically disabled if you do not have configured $cfg['blowfish_secret'].
$cfg['LoginCookieValidity'] integer [number of seconds]
Define how long is login cookie valid. Please note that php configuration option session.gc_maxlifetime might limit session validity and if session is lost, login cookie is also invalidated. So it is a good idea to set session.gc_maxlifetime not lower than the value of $cfg['LoginCookieValidity'].
$cfg['LoginCookieStore'] integer [number of seconds]
Define how long is login cookie should be stored in browser. Default 0 means that it will be kept for existing session. This is recommended for not trusted environments.
$cfg['LoginCookieDeleteAll'] boolean
If enabled (default), logout deletes cookies for all servers, otherwise only for current one. Setting this to false makes it easy to forget to log out from other server, when you are using more of them.
$cfg['UseDbSearch'] boolean
Define whether the "search string inside database" is enabled or not.
$cfg['IgnoreMultiSubmitErrors'] boolean
Define whether phpMyAdmin will continue executing a multi-query statement if one of the queries fails. Default is to abort execution.
$cfg['VerboseMultiSubmit'] boolean
Define whether phpMyAdmin will output the results of each query of a multi-query statement embedded into the SQL output as inline comments. Defaults to TRUE.
$cfg['AllowArbitraryServer'] boolean
If enabled allows you to log in to arbitrary servers using cookie auth.

NOTE: Please use this carefully, as this may allow users access to MySQL servers behind the firewall where your HTTP server is placed.
$cfg['Error_Handler']['display'] boolean
Whether to display errors from PHP or not.
$cfg['Error_Handler']['gather'] boolean
Whether to gather errors from PHP or not.
$cfg['LeftFrameLight'] boolean
Defines whether to use a select-based menu and display only the current tables in the left frame (smaller page). Only in Non-Lightmode you can use the feature to display nested folders using $cfg['LeftFrameTableSeparator']
$cfg['LeftFrameDBTree'] boolean
In light mode, defines whether to display the names of databases (in the selector) using a tree, see also $cfg['LeftFrameDBSeparator'].
$cfg['LeftFrameDBSeparator'] string or array
The string used to separate the parts of the database name when showing them in a tree. Alternatively you can specify more strings in an array and all of them will be used as a separator.
$cfg['LeftFrameTableSeparator'] string
Defines a string to be used to nest table spaces. Defaults to '__'. This means if you have tables like 'first__second__third' this will be shown as a three-level hierarchy like: first > second > third. If set to FALSE or empty, the feature is disabled. NOTE: You should not use this separator at the beginning or end of a table name or multiple times after another without any other characters in between.
$cfg['LeftFrameTableLevel'] string
Defines how many sublevels should be displayed when splitting up tables by the above separator.
$cfg['ShowTooltip'] boolean
Defines whether to display table comment as tool-tip in left frame or not.
$cfg['ShowTooltipAliasDB'] boolean
If tool-tips are enabled and a DB comment is set, this will flip the comment and the real name. That means that if you have a table called 'user0001' and add the comment 'MyName' on it, you will see the name 'MyName' used consequently in the left frame and the tool-tip shows the real name of the DB.
$cfg['ShowTooltipAliasTB'] boolean/string
Same as $cfg['ShowTooltipAliasDB'], except this works for table names. When setting this to 'nested', the Alias of the Tablename is only used to split/nest the tables according to the $cfg['LeftFrameTableSeparator'] directive. So only the folder is called like the Alias, the tablename itself stays the real tablename.
Defines whether or not to display the phpMyAdmin logo at the top of the left frame. Defaults to TRUE.
Enter URL where logo in the navigation frame will point to. For use especially with self made theme which changes this. The default value for this is main.php.
$cfg['LeftLogoLinkWindow'] string
Whether to open the linked page in the main window (main) or in a new one (new). Note: use new if you are linking to phpmyadmin.net.
$cfg['LeftDisplayServers'] boolean
Defines whether or not to display a server choice at the top of the left frame. Defaults to FALSE.
$cfg['DisplayServersList'] boolean
Defines whether to display this server choice as links instead of in a drop-down. Defaults to FALSE (drop-down).
$cfg['DisplayDatabasesList'] boolean or text
Defines whether to display database choice in light navigation frame as links instead of in a drop-down. Defaults to 'auto' - on main page list is shown, when database is selected, only drop down is displayed.
$cfg['LeftDefaultTabTable'] string
Defines the tab displayed by default when clicking the small icon next to each table name in the navigation panel. Possible values: "tbl_structure.php", "tbl_sql.php", "tbl_select.php", "tbl_change.php" or "sql.php".
$cfg['ShowStats'] boolean
Defines whether or not to display space usage and statistics about databases and tables.
Note that statistics requires at least MySQL 3.23.3 and that, at this date, MySQL doesn't return such information for Berkeley DB tables.
$cfg['ShowServerInfo'] boolean
Defines whether to display detailed server information on main page. You can additionally hide more information by using $cfg['Servers'][$i]['verbose'].
$cfg['ShowPhpInfo'] boolean
$cfg['ShowChgPassword'] boolean
$cfg['ShowCreateDb'] boolean
Defines whether to display the "PHP information" and "Change password " links and form for creating database or not at the starting main (right) frame. This setting does not check MySQL commands entered directly.

Please note that to block the usage of phpinfo() in scripts, you have to put this in your php.ini:
disable_functions = phpinfo()
Also note that enabling the "Change password " link has no effect with "config" authentication mode: because of the hard coded password value in the configuration file, end users can't be allowed to change their passwords.
$cfg['SuggestDBName'] boolean
Defines whether to suggest a database name on the "Create Database" form or to keep the textfield empty.
$cfg['NavigationBarIconic'] string
Defines whether navigation bar buttons and the right panel top menu contain text or symbols only. A value of TRUE displays icons, FALSE displays text and 'both' displays both icons and text.
$cfg['ShowAll'] boolean
Defines whether a user should be displayed a "show all (records)" button in browse mode or not.
$cfg['MaxRows'] integer
浏览一个结果集时一次显示的最多行数。如果结果集超过此值,将会显示 "上一页" 和 "下一页" 的链接。
$cfg['Order'] string [DESC|ASC|SMART]
Defines whether columns are displayed in ascending (ASC) order, in descending (DESC) order or in a "smart" (SMART) order - I.E. descending order for columns of type TIME, DATE, DATETIME and TIMESTAMP, ascending order else- by default.
$cfg['DisplayBinaryAsHex'] boolean
Defines whether the "Show binary contents as HEX" browse option is ticked by default.
$cfg['ProtectBinary'] boolean or string
Defines whether BLOB or BINARY columns are protected from editing when browsing a table's content. Valid values are:
  • FALSE to allow editing of all columns;
  • 'blob' to allow editing of all columns except BLOBS;
  • 'all' to disallow editing of all BINARY or BLOB columns.
$cfg['ShowFunctionFields'] boolean
Defines whether or not MySQL functions fields should be initially displayed in edit/insert mode. Since version 2.10, the user can toggle this setting from the interface.
$cfg['ShowFieldTypesInDataEditView'] boolean
Defines whether or not type fields should be initially displayed in edit/insert mode. The user can toggle this setting from the interface.
$cfg['CharEditing'] string
Defines which type of editing controls should be used for CHAR and VARCHAR columns. Possible values are:
  • input - this allows to limit size of text to size of columns in MySQL, but has problems with newlines in columns
  • textarea - no problems with newlines in columns, but also no length limitations
Default is old behavior so input.
$cfg['InsertRows'] integer
Defines the maximum number of concurrent entries for the Insert page.
$cfg['ForeignKeyMaxLimit'] integer
If there are fewer items than this in the set of foreign keys, then a drop-down box of foreign keys is presented, in the style described by the $cfg['ForeignKeyDropdownOrder'] setting.
$cfg['ForeignKeyDropdownOrder'] array
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'] boolean
$cfg['GZipDump'] boolean
$cfg['BZipDump'] boolean
Defines whether to allow the use of zip/GZip/BZip2 compression when creating a dump file
$cfg['CompressOnFly'] boolean
Defines whether to allow on the fly compression for GZip/BZip2 compressed exports. This doesn't affect smaller dumps and allows users to create larger dumps that won't otherwise fit in memory due to php memory limit. Produced files contain more GZip/BZip2 headers, but all normal programs handle this correctly.
$cfg['LightTabs'] boolean
If set to TRUE, use less graphically intense tabs on the top of the mainframe.
$cfg['PropertiesIconic'] string
If set to TRUE, will display icons instead of text for db and table properties links (like 'Browse', 'Select', 'Insert', ...).
Can be set to 'both' if you want icons AND text.
When set to FALSE, will only show text.
$cfg['PropertiesNumColumns'] integer
How many columns will be utilized to display the tables on the database property view? Default is 1 column. When setting this to a value larger than 1, the type of the database will be omitted for more display space.
$cfg['DefaultTabServer'] string
Defines the tab displayed by default on server view. Possible values: "main.php" (recommended for multi-user setups), "server_databases.php", "server_status.php", "server_variables.php", "server_privileges.php" or "server_processlist.php".
$cfg['DefaultTabDatabase'] string
Defines the tab displayed by default on database view. Possible values: "db_structure.php", "db_sql.php" or "db_search.php".
$cfg['DefaultTabTable'] string
Defines the tab displayed by default on table view. Possible values: "tbl_structure.php", "tbl_sql.php", "tbl_select.php", "tbl_change.php" or "sql.php".
$cfg['MySQLManualBase'] string
If set to an URL which points to the MySQL documentation (type depends on $cfg['MySQLManualType']), appropriate help links are generated.
See MySQL Documentation page for more information about MySQL manuals and their types.
$cfg['MySQLManualType'] string
Type of MySQL documentation:
  • viewable - "viewable online", current one used on MySQL website
  • searchable - "Searchable, with user comments"
  • chapters - "HTML, one page per chapter"
  • big - "HTML, all on one page"
  • none - do not show documentation links
$cfg['DefaultLang'] string
Defines the default language to use, if not browser-defined or user-defined.
The corresponding language file needs to be in locale/code/LC_MESSAGES/phpmyadmin.mo.
$cfg['DefaultConnectionCollation'] string
Defines the default connection collation to use, if not user-defined.
See the MySQL documentation for list of possible values.
$cfg['Lang'] string
Force language to use.
The corresponding language file needs to be in locale/code/LC_MESSAGES/phpmyadmin.mo.
$cfg['FilterLanguages'] string
Limit list of available languages to those matching the given regular expression. For example if you want only Czech and English, you should set filter to '^(cs|en)'.
$cfg['RecodingEngine'] string
You can select here which functions will be used for character set conversion. Possible values are:
  • auto - automatically use available one (first is tested iconv, then recode)
  • iconv - use iconv or libiconv functions
  • recode - use recode_string function
  • none - disable encoding conversion
Default is auto.
Enabled charset conversion activates a pull-down menu in the Export and Import pages, to choose the character set when exporting a file. The default value in this menu comes from $cfg['Export']['charset'] and $cfg['Import']['charset'].
$cfg['IconvExtraParams'] string
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 recode/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.
$cfg['TrustedProxies'] array
Lists proxies and HTTP headers which are trusted for IP Allow/Deny. 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.

The following example specifies that phpMyAdmin should trust a HTTP_X_FORWARDED_FOR (X-Forwarded-For) header coming from the proxy 1.2.3.4:
$cfg['TrustedProxies'] =
     array('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'] string
Specifies whether GD >= 2 is available. If yes it can be used for MIME transformations.
Possible values are:
  • auto - automatically detect, this is a bit expensive operation for php < 4.3.0 so it is preferred to change this according to your server real possibilities
  • yes - GD 2 functions can be used
  • no - GD 2 function cannot be used
Default is auto.
$cfg['CheckConfigurationPermissions'] boolean
We normally check the permissions on the configuration file to ensure it's not world writable. However, phpMyAdmin could be installed on a NTFS filesystem mounted on a non-Windows server, in which case the permissions seems wrong but in fact cannot be detected. In this case a sysadmin would set this parameter to FALSE. Default is TRUE.
$cfg['LinkLengthLimit'] integer
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 URLs. Default is 1000.
$cfg['NaviWidth'] integer
Navi frame width in pixels. See themes/themename/layout.inc.php.
$cfg['NaviBackground'] string [valid css code for background]
$cfg['MainBackground'] string [valid css code for background]
The background styles used for both the frames. See themes/themename/layout.inc.php.
$cfg['NaviPointerBackground'] string [valid css code for background]
$cfg['NaviPointerColor'] string [valid css color]
The style used for the pointer in the navi frame. See themes/themename/layout.inc.php.
$cfg['NaviDatabaseNameColor'] string [valid css code]
The color used for the database name in the navi frame. See themes/themename/layout.inc.php.
$cfg['LeftPointerEnable'] boolean
A value of TRUE activates the navi pointer (when LeftFrameLight is FALSE).
$cfg['Border'] integer
The size of a table's border. See themes/themename/layout.inc.php.
$cfg['ThBackground'] string [valid css code for background]
$cfg['ThColor'] string [valid css color]
The style used for table headers. See themes/themename/layout.inc.php.
$cfg['BgOne'] string [HTML color]
The color (HTML) #1 for table rows. See themes/themename/layout.inc.php.
$cfg['BgTwo'] string [HTML color]
The color (HTML) #2 for table rows. See themes/themename/layout.inc.php.
$cfg['BrowsePointerBackground'] string [HTML color]
$cfg['BrowsePointerColor'] string [HTML color]
$cfg['BrowseMarkerBackground'] string [HTML color]
$cfg['BrowseMarkerColor'] string [HTML color]
The colors (HTML) uses for the pointer and the marker in browse mode.
The former feature highlights the row over which your mouse is passing and the latter lets you visually mark/unmark rows by clicking on them.
See themes/themename/layout.inc.php.
$cfg['FontFamily'] string
You put here a valid CSS font family value, for example arial, sans-serif.
See themes/themename/layout.inc.php.
$cfg['FontFamilyFixed'] string
You put here a valid CSS font family value, for example monospace. This one is used in textarea.
See themes/themename/layout.inc.php.
$cfg['BrowsePointerEnable'] boolean
Whether to activate the browse pointer or not.
$cfg['BrowseMarkerEnable'] boolean
Whether to activate the browse marker or not.
$cfg['TextareaCols'] integer
$cfg['TextareaRows'] integer
$cfg['CharTextareaCols'] integer
$cfg['CharTextareaRows'] integer
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']).
$cfg['LongtextDoubleTextarea'] boolean
Defines whether textarea for LONGTEXT columns should have double size.
$cfg['TextareaAutoSelect'] boolean
Defines if the whole textarea of the query box will be selected on click.
$cfg['CtrlArrowsMoving'] boolean
Enable Ctrl+Arrows (Option+Arrows in Safari) moving between fields when editing.
$cfg['LimitChars'] integer
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.
$cfg['ModifyDeleteAtLeft'] boolean $cfg['ModifyDeleteAtRight'] boolean
Defines the place where modify and delete links would be put when tables contents are displayed (you may have them displayed both at the left and at the right). "Left" and "right" are parsed as "top" and "bottom" with vertical display mode.
$cfg['DefaultDisplay'] string
There are 3 display modes: horizontal, horizontalflipped and vertical. Define which one is displayed by default. The first mode displays each row on a horizontal line, the second rotates the headers by 90 degrees, so you can use descriptive headers even though columns only contain small values and still print them out. The vertical mode sorts each row on a vertical lineup.
$cfg['HeaderFlipType'] string
The HeaderFlipType can be set to 'auto', 'css' or 'fake'. When using 'css' the rotation of the header for horizontalflipped is done via CSS. The CSS transformation currently works only in Internet Explorer.If set to 'fake' PHP does the transformation for you, but of course this does not look as good as CSS. The 'auto' option enables CSS transformation when browser supports it and use PHP based one otherwise.
$cfg['DefaultPropDisplay'] string or integer
When editing/creating new columns in a table all fields normally get lined up one field a line. (default: 'horizontal'). If you set this to 'vertical' you can have each field lined up vertically beneath each other. You can save up a lot of place on the horizontal direction and no longer have to scroll. If you set this to integer, editing of fewer columns will appear in 'vertical' mode, while editing of more columns still in 'horizontal' mode. This way you can still effectively edit large number of columns, while having full view on few of them.
$cfg['ShowBrowseComments'] boolean
$cfg['ShowPropertyComments'] boolean
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['SQLQuery']['Edit'] boolean
Whether to display an edit link to change a query in any SQL Query box.
$cfg['SQLQuery']['Explain'] boolean
Whether to display a link to explain a SELECT query in any SQL Query box.
$cfg['SQLQuery']['ShowAsPHP'] boolean
Whether to display a link to wrap a query in PHP code in any SQL Query box.
$cfg['SQLQuery']['Validate'] boolean
Whether to display a link to validate a query in any SQL Query box. See also $cfg_SQLValidator.
$cfg['SQLQuery']['Refresh'] boolean
Whether to display a link to refresh a query in any SQL Query box.
$cfg['UploadDir'] string
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 note that if PHP is running in safe mode, this directory must be owned by the same user as the owner of the phpMyAdmin scripts.

See also FAQ 1.16 for alternatives.
$cfg['SaveDir'] string
The name of the directory where dumps can be saved.

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

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

Please note that if PHP is running in safe mode, this directory must be owned by the same user as the owner of the phpMyAdmin scripts.
$cfg['TempDir'] string
The name of the directory where temporary files can be stored.

This is needed for native MS Excel export, see FAQ 6.23 and to work around limitations of open_basedir for uploaded files, see FAQ 1.11.

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 web server. However for security reasons, this directory should be outside the tree published by webserver. If you cannot avoid having this directory published by webserver, place at least an empty index.html file there, so that directory listing is not possible.

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.
$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']['method'] string
Defines how the export form is displayed when it loads. Valid values are:
  • quick to display the minimum number of options to configure
  • custom to display every available option to configure
  • custom-no-form same as custom but does not display the option of using quick export
$cfg['Import'] array
In this array are defined default parameters for import, names of items are similar to texts seen on import page, so you can easily identify what they mean.
$cfg['RepeatCells'] integer
Repeat the headers every X cells, or 0 to deactivate.
$cfg['EditInWindow'] boolean
$cfg['QueryWindowWidth'] integer
$cfg['QueryWindowHeight'] integer
$cfg['QueryHistoryDB'] boolean
$cfg['QueryWindowDefTab'] string
$cfg['QueryHistoryMax'] integer
All those variables affect the query window feature. A SQL link or icon is always displayed on the left panel. If JavaScript is enabled in your browser, a click on this opens a distinct query window, which is a direct interface to enter SQL queries. Otherwise, the right panel changes to display a query box.

The size of this query window can be customized with $cfg['QueryWindowWidth'] and $cfg['QueryWindowHeight'] - both integers for the size in pixels. Note that normally, those parameters will be modified in layout.inc.php for the theme you are using.

If $cfg['EditInWindow'] is set to true, a click on [Edit] from the results page (in the "Showing Rows" section) opens the query window and puts the current query inside it. If set to false, clicking on the link puts the SQL query in the right panel's query box.

The usage of the JavaScript query window is recommended if you have a JavaScript enabled browser. Basic functions are used to exchange quite a few variables, so most 4th generation browsers should be capable to use that feature. It currently is only tested with Internet Explorer 6 and Mozilla 1.x.

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'].

The query window also has a custom tabbed look to group the features. Using the variable $cfg['QueryWindowDefTab'] you can specify the default tab to be used when opening the query window. It can be set to either 'sql', 'files', 'history' or 'full'.
$cfg['BrowseMIME'] boolean
Enable MIME-transformations.
$cfg['MaxExactCount'] integer
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.
$cfg['MaxExactCountViews'] integer
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. The default value of 0 bypasses any row counting.
$cfg['NaturalOrder'] boolean
Sorts database and table names according to natural order (for example, t1, t2, t10). Currently implemented in the left panel (Light mode) and in Database view, for the table list.
$cfg['InitialSlidersState'] string
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 libraries/config/user_preferences.forms.php.
$cfg['TitleTable'] string
$cfg['TitleDatabase'] string
$cfg['TitleServer'] string
$cfg['TitleDefault'] string
Allows you to specify window's title bar. You can use format string expansion.
$cfg['ErrorIconic'] boolean
Uses icons for warnings, errors and informations.
$cfg['MainPageIconic'] boolean
Uses icons on main page in lists and menu tabs.
$cfg['ReplaceHelpImg'] boolean
Shows a help button instead of the "Documentation" message.
$cfg['ThemePath'] string
If theme manager is active, use this as the path of the subdirectory containing all the themes.
$cfg['ThemeManager'] boolean
Enables user-selectable themes. See FAQ 2.7.
$cfg['ThemeDefault'] string
The default theme (a subdirectory under cfg['ThemePath']).
$cfg['ThemePerServer'] boolean
Whether to allow different theme for each server.
$cfg['DefaultQueryTable'] string
$cfg['DefaultQueryDatabase'] string
Default queries that will be displayed in query boxes when user didn't specify any. You can use standard format string expansion.
$cfg['SQP']['fmtType'] string [html|none]
The main use of the new SQL Parser is to pretty-print SQL queries. By default we use HTML to format the query, but you can disable this by setting this variable to 'none'.
$cfg['SQP']['fmtInd'] float
$cfg['SQP']['fmtIndUnit'] string [em|px|pt|ex]
For the pretty-printing of SQL queries, under some cases the part of a query inside a bracket is indented. By changing $cfg['SQP']['fmtInd'] you can change the amount of this indent.
Related in purpose is $cfg['SQP']['fmtIndUnit'] which specifies the units of the indent amount that you specified. This is used via stylesheets.
$cfg['SQP']['fmtColor'] array of string tuples
This array is used to define the colours for each type of element of the pretty-printed SQL queries. The tuple format is
class => [HTML colour code | empty string]
If you specify an empty string for the color of a class, it is ignored in creating the stylesheet. You should not alter the class names, only the colour strings.
Class name key:
  • comment Applies to all comment sub-classes
  • comment_mysql Comments as "#...\n"
  • comment_ansi Comments as "-- ...\n"
  • comment_c Comments as "/*...*/"
  • digit Applies to all digit sub-classes
  • digit_hex Hexadecimal numbers
  • digit_integer Integer numbers
  • digit_float Floating point numbers
  • punct Applies to all punctuation sub-classes
  • punct_bracket_open_round Opening brackets"("
  • punct_bracket_close_round Closing brackets ")"
  • punct_listsep List item Separator ","
  • punct_qualifier Table/Column Qualifier "."
  • punct_queryend End of query marker ";"
  • alpha Applies to all alphabetic classes
  • alpha_columnType Identifiers matching a column type
  • alpha_columnAttrib Identifiers matching a database/table/column attribute
  • alpha_functionName Identifiers matching a MySQL function name
  • alpha_reservedWord Identifiers matching any other reserved word
  • alpha_variable Identifiers matching a SQL variable "@foo"
  • alpha_identifier All other identifiers
  • quote Applies to all quotation mark classes
  • quote_double Double quotes "
  • quote_single Single quotes '
  • quote_backtick Backtick quotes `
$cfg['SQLValidator'] boolean
$cfg['SQLValidator']['use'] boolean
phpMyAdmin now supports use of the Mimer SQL Validator service, as originally published on Slashdot.
For help in setting up your system to use the service, see the FAQ 6.14.
$cfg['SQLValidator']['username'] string
$cfg['SQLValidator']['password'] string
The SOAP service allows you to log in with anonymous and any password, so we use those by default. Instead, if you have an account with them, you can put your login details here, and it will be used in place of the anonymous login.
$cfg['DBG']
DEVELOPERS ONLY!
$cfg['DBG']['sql'] boolean
DEVELOPERS ONLY!
Enable logging queries and execution times to be displayed in the bottom of main page (right frame).
$cfg['DBG']['php'] boolean
DEVELOPERS ONLY!
Enable the DBG extension for debugging phpMyAdmin. Required for profiling the code.
For help in setting up your system to this, see the Developers section.
$cfg['DBG']['profile']['enable'] boolean
DEVELOPERS ONLY!
Enable profiling support for phpMyAdmin. This will append a chunk of data to the end of every page displayed in the main window with profiling statistics for that page.
You may need to increase the maximum execution time for this to complete successfully.Profiling was removed from the code for version 2.9.0 due to licensing issues.
$cfg['DBG']['profile']['threshold'] float (units in milliseconds)
DEVELOPERS ONLY!
When profiling data is displayed, this variable controls the threshold of display for any profiling data, based on the average time each time has taken. If it is over the threshold it is displayed, otherwise it is not displayed. This takes a value in milliseconds. In most cases you don't need to edit this.
$cfg['ColumnTypes'] array
All possible types of a MySQL column. In most cases you don't need to edit this.
$cfg['AttributeTypes'] array
Possible attributes for columns. In most cases you don't need to edit this.
$cfg['Functions'] array
A list of functions MySQL supports. In most cases you don't need to edit this.
$cfg['RestrictColumnTypes'] array
Mapping of column types to meta types used for preferring displayed functions. In most cases you don't need to edit this.
$cfg['RestrictFunctions'] array
Functions preferred for column meta types as defined in $cfg['RestrictColumnTypes']. In most cases you don't need to edit this.
$cfg['DefaultFunctions'] array
Functions selected by default when inserting/changing row, Functions are defined for meta types from $cfg['RestrictColumnTypes'] and for first_timestamp, which is used for first timestamp column in table.
$cfg['NumOperators'] array
Operators available for search operations on numeric and date columns.
$cfg['TextOperators'] array
Operators available for search operations on character columns. Note that we put LIKE by default instead of LIKE %...%, to avoid unintended performance problems in case of huge tables.
$cfg['EnumOperators'] array
Operators available for search operations on ENUM columns.
$cfg['NullOperators'] array
Additional operators available for search operations when the column can be null.

Transformations

  1. Introduction
  2. Usage
  3. File structure

1. Introduction

To enable transformations, you have to setup the column_info table and the proper directives. Please see the Configuration section on how to do so.

You can apply different transformations to the contents of each column. The transformation will take the content of each column and transform it with certain rules defined in the selected transformation.

Say you have a column 'filename' which contains a filename. Normally you would see in phpMyAdmin only this filename. Using transformations you can transform that filename into a HTML link, so you can click inside of the phpMyAdmin structure on the column's link and will see the file displayed in a new browser window. Using transformation options you can also specify strings to append/prepend to a string or the format you want the output stored in.

For a general overview of all available transformations and their options, you can consult your <www.your-host.com>/<your-install-dir>/transformation_overview.php installation.

For a tutorial on how to effectively use transformations, see our Link section on the official phpMyAdmin homepage.

2. Usage

Go to your tbl_structure.php page (i.e. reached through clicking on the 'Structure' link for a table). There click on "Change" (or change icon) and there you will see three new fields at the end of the line. They are called 'MIME-type', 'Browser transformation' and 'Transformation options'.

3. File structure

All mimetypes and their transformations are defined through single files in the directory 'libraries/transformations/'.

They are stored in files to ease up customization and easy adding of new transformations.

Because the user cannot enter own mimetypes, it is kept sure that transformations always work. It makes no sense to apply a transformation to a mimetype the transform-function doesn't know to handle.

One can, however, use empty mime-types and global transformations which should work for many mimetypes. You can also use transforms on a different mimetype than what they where built for, but pay attention to option usage as well as what the transformation does to your column.

There is a basic file called 'global.inc.php'. This function can be included by any other transform function and provides some basic functions.

There are 5 possible file names:

  1. A mimetype+subtype transform:

    [mimetype]_[subtype]__[transform].inc.php

    Please not that mimetype and subtype are separated via '_', which shall not be contained in their names. The transform function/filename may contain only characters which cause no problems in the file system as well as the PHP function naming convention.

    The transform function will the be called 'PMA_transform_[mimetype]_[subtype]__[transform]()'.

    Example:

    text_html__formatted.inc.php
    PMA_transform_text_html__formatted()
  2. A mimetype (w/o subtype) transform:

    [mimetype]__[transform].inc.php

    Please note that there are no single '_' characters. The transform function/filename may contain only characters which cause no problems in the file system as well as the PHP function naming convention.

    The transform function will the be called 'PMA_transform_[mimetype]__[transform]()'.

    Example:

    text__formatted.inc.php
    PMA_transform_text__formatted()
  3. A mimetype+subtype without specific transform function

    [mimetype]_[subtype].inc.php

    Please note that there are no '__' characters in the filename. Do not use special characters in the filename causing problems with the file system.

    No transformation function is defined in the file itself.

    Example:

    text_plain.inc.php
    (No function)
  4. A mimetype (w/o subtype) without specific transform function

    [mimetype].inc.php

    Please note that there are no '_' characters in the filename. Do not use special characters in the filename causing problems with the file system.

    No transformation function is defined in the file itself.

    Example:

    text.inc.php
    (No function)
  5. A global transform function with no specific mimetype

    global__[transform].inc.php

    The transform function will the be called 'PMA_transform_global__[transform]()'.

    Example:

    global__formatted
    PMA_transform_global__formatted()

So generally use '_' to split up mimetype and subtype, and '__' to provide a transform function.

All filenames containing no '__' in themselves are not shown as valid transform functions in the dropdown.

Please see the libraries/transformations/TEMPLATE file for adding your own transform function. See the libraries/transformations/TEMPLATE_MIMETYPE for adding a mimetype without a transform function.

To create a new transform function please see libraries/transformations/template_generator.sh. To create a new, empty mimetype please see libraries/transformations/template_generator_mimetype.sh.

A transform function always gets passed three variables:

  1. $buffer - Contains the text inside of the column. This is the text, you want to transform.
  2. $options - Contains any user-passed options to a transform function as an array.
  3. $meta - Contains an object with information about your column. The data is drawn from the output of the mysql_fetch_field() function. This means, all object properties described on the manual page are available in this variable and can be used to transform a column accordingly to unsigned/zerofill/not_null/... properties.
    The $meta->mimetype variable contains the original MIME-type of the column (i.e. 'text/plain', 'image/jpeg' etc.)

Additionally you should also provide additional function to provide information about the transformation to the user. This function should have same name as transformation function just with appended _info suffix. This function accepts no parameters and returns array with information about the transformation. Currently following keys can be used:

info
Long description of the transformation.

常见问题

  1. Server
  2. 设置
  3. 已知问题
  4. ISPs, multi-user installations
  5. 浏览器和客户端操作系统
  6. 使用 phpMyAdmin
  7. phpMyAdmin 项目
  8. 安全
  9. 同步

请到我们的官方网站上查看更多有关 phpMyAdmin 的特性和接口方面的信息。

服务器

1.1 My server is crashing each time a specific action is required or phpMyAdmin sends a blank page or a page full of cryptic characters to my browser, what can I do?

config.inc.php 文件中将 $cfg['OBGzip'] 显式地设为 FALSE,同时将 PHP 配置文件中的 zlib.output_compression 显式地设置为 Off

1.2 使用 phpMyAdmin 时,我的 Apache 服务器崩溃了。

请将 Apache 更新到最新版本(如果可能的话,请将 MySQL 也更新到最新版本)。
参考 常见问题 1.1 中有关 PHP 输出缓冲的问题。
如果你的服务器依旧崩溃,请向 Apache 技术支持小组寻求帮助。

1.3 (withdrawn).

1.4 我在 IIS 上使用 phpMyAdmin,网页显示了这样一段错误信息:"CGI 应用程序错误,返回了不完整的HTTP 头 ..."。

您是不是忘记阅读 PHP 发行版中的 install.txt 了?请参考 PHP 官方错误数据库中的这个错误反馈

1.5 Using phpMyAdmin on IIS, I'm facing crashes and/or many error messages with the HTTP.

这是一个已知的 PHP ISAPI 过滤器错误:PHP 的 ISAPI 过滤器不是很稳定,建议使用 cookie 认证方式。

1.6 我无法在 PWS 上使用 phpMyAdmin,网页显示一片空白。

这看上去像是 PWS 的 Bug。Filippo Simoncini 找到了一个解决方法,这是目前最好的解决方法:从 libraries/header.inc.php, libraries/header_printview.inc.php, index.php, navigation.phplibraries/common.lib.php 这几个文件中删除 DOCTYPE(共2行)。

1.7 如何使用 Gzip 或 Bzip 压缩 CSV 和其他类型的导出文件? 我设置了相关选项但是似乎不起作用。

These features are based on the gzencode() and bzcompress() PHP functions to be more independent of the platform (Unix/Windows, Safe Mode or not, and so on). So, you must have Zlib/Bzip2 support (--with-zlib and --with-bz2).

1.8 我无法向表中插入文本文件,并且有错误提示说这是因为在安全模式无法进行这样的操作。

您上传的文件被保存在 "上传目录",这个目录可以在 php.ini 中设置(默认设置是 /tmp)。
我们推荐您按照下面的步骤将 Apache 服务器配置在安全模式下运行,这可以保证安全的前提下允许上传文件(本操作仅适用于类 Unix 操作系统):

1.9 (withdrawn).

1.10 我在上传文件的时候遇到了问题,phpMyAdmin 运行在安全服务器上,服务器软件是 Apache,我使用的浏览器是 Internet Explorer。

"Rob M" 在 PHP 帮助论坛给出了解决方法:将下面一行加入到您的 httpd.conf 文件中

SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown

该方法似乎可以解决许多使用 Internet Explorer 或 SSL 时遇到的问题。

1.11 我试图从查询窗口上传文件时发生了错误,错误信息是 '开放目录限制'(open_basedir restriction)

从 2.2.4 版本开始,phpMyAdmin 支持服务器上的开放目录限制(open_basedir restrictions)。但是,你需要进行设置才能使用此功能。请创建一个临时目录,并将 $cfg['TempDir'] 设置为临时目录的路径。您上传的文件将会被临时存放在此目录下,SQL 语句执行完毕以后,临时文件就会被删除。

1.12 我忘了 MySQL 的 root 密码,怎么办?

请参考 MySQL 手册:重设权限.

1.13 (withdrawn).

1.14 (withdrawn).

1.15 I have problems with mysql.user column names.

In previous MySQL versions, the User and Passwordcolumns were named user and password. Please modify your column names to align with current standards.

1.16 我无法上传转储文件,上传时遇到了内存、 HTTP 、超时等方面的错误).

phpMyAdmin 在 2.7.0 重写了导入引擎,并修复了以上问题。如果可能,请升级 phpMyAdmin 到最新版本,并体验 phpMyAdmin 新版给您带来的新特性。

请检查 php.ini 文件中的 upload_max_filesizememory_limit 以及 post_max_size 的设置值。这三个选项都会影响您可以上传的文件大小和 PHP 能够处理的文件大小。如果您没有服务器管理权,请联系服务器管理员(或服务器提供商)检查这几项设置。另外,有用户反应 post_max_size 和 memory_limit 的设置值必须比 upload_max_filesize 的设置值大。

如果您上传的文件很大,或者服务器管理员或提供商不愿意修改以上几个设置,请参考下面的解决方法:

1.17 phpMyAdmin 支持什么版本的 MySQL?

从 phpMyAdmin 3.0.x 开始,我们只支持 MySQL 5.0.1 或更新的 MySQL 版本。对于过去的 MySQL 版本,您必须使用 phpMyAdmin 2.8.x 分支版本。这是因为,由于 PHP 的 MySQL 扩展升级到 MySQLi(improved MySQL extension ),新版的 phpMyAdmin 使用 MySQLi 而无法连接到旧版的 MySQL。MySQLi 比传统的 MySQL 扩展更好,如果没有特殊的原因,我们没理由使用以前的 MySQL 扩展。
When compiling php, we strongly recommend that you manually link the MySQL extension of your choice to a MySQL client library of at least the same minor version since the one that is bundled with some PHP distributions is rather old and might cause problems (see FAQ 1.17a). If your webserver is running on a windows system, you might want to try MySQL's Connector/PHP instead of the MySQL / MySQLi extensions that are bundled with the official php Win32 builds.

1.17a 我无法连接到 MySQL 服务器,它总是提示这个错误:"客户端不支持服务器要求的认证方式,请升级 MySQL 客户端"

You tried to access MySQL with an old MySQL client library. The version of your MySQL client library can be checked in your phpinfo() output. In general, it should have at least the same minor version as your server - as mentioned in FAQ 1.17.

通常在使用 MySQL 4.1 版本时会遇到此问题。MySQL 改变了认证过程中的哈希值,但 PHP 仍使用旧的方法计算此值。要解决此问题,请使用 mysqli 扩展和与 MySQL 服务器相容的客户端库。您可以在 $cfg['Servers'][$i]['extension'] 设置中设置使用 MySQLi。有关更多内容请阅读MySQL 手册

1.18 (withdrawn).

1.19 我无法使用"显示关系"功能。似乎脚本不认识我正在使用的字体。

在此功能中我们使用了 "FPDF" 库,该库还需要其他的一些文件才能使用自定义字体(font faces)。
请参考 FPDF 手册 来生成这些必要的文件。

1.20 我得到了这样的错误信息: "无法载入 MySQL 扩展,请检查 PHP 配置"。

要连接到 MySQL 服务器,PHP 需要使用 MySQL 扩展中相关的 MySQL 函数。这个扩展应该需要编译到 PHP 中,或者以动态方式加载。如果是以动态方式加载,动态库的文件有可能是 mysql.sophp_mysql.dll。phpMyAdmin 试图加载动态库文件,但加载失败了。

通常情况下,安装 "PHP-MySQL" 或者其他类似的软件包即可解决此问题。

1.21 我在 Unix 下以 CGI 方式运行 PHP,但却无法使用 cookie 认证方式来登录。

php.ini 文件中将 mysql.max_links 设为比1大的值。

1.22 我找不到 "选择文件" 的按钮,那该怎么上传文件?

通常这是因为您没有在 php.ini 中将 file_uploads 选项设置为 "on"。

1.23 I'm running MySQL on a Win32 machine. Each time I create a new table the table and column names are changed to lowercase!

这是因为 Win32 版本的 MySQL 默认将 lower_case_table_names 设置为1(ON)。您可以将此设置显式地设为0(也就是OFF)来解决这个问题:
打开 my.ini 文件,这个文件应该在您的 Windows 目录下,在“[mysqld]”后一行增加:

set-variable = lower_case_table_names=0

然后,重新启动 MySQL。您也可以使用如下的查询语句来查询此设置值:

SHOW VARIABLES LIKE 'lower_case_table_names';

1.24 (withdrawn).

1.25 我在 Windows XP 上使用 Apache,并加载了mod_gzip-1.3.26.1a。在运行 SQL 查询时出现了类似变量未定义的错误。

Jose Fandos 给出的解决方法:在 httpd.conf 中增加下面两行:

# mod_gzip_item_include file \.php$
# mod_gzip_item_include mime "application/x-httpd-php.*"

该 Windows 版本的 Apache mod_gzip 模块在处理 PHP 脚本时有些小问题。修改 httpd.conf 后,请重新启动 Apache。

1.26 我将 phpMyAdmin 安装在了 IIS 根目录下,在我打开 phpMyAdmin 页面时,却出现了这样的错误:"No input file specified"

这是一个权限问题。右键单击 phpMyAdmin 目录,选择 属性-->-->安全-->增加,然后选择在用户列表中选择 IUSR_machine 用户,赋予其权限,即可解决此问题。

1.27 当我打开一个很大的页面时,页面显示空白(如 db_structure.php 页面中显示了很多表的时候)

这是一个 PHP 错误,该错误会在打开 GZIP 输出的时候发生。如果您在 config.inc.php 中修改 $cfg['OBGzip'] = false 选项来关闭这个功能,就能解决此问题。这个错误将会在 PHP 5.0.0 版本中修复。

1.28 我的 MySQL 服务器偶尔会返回 'Errorcode: 13' 这样的错误信息,这是神么意思?

这个错误可能是因为 lower_case_table_names 被设为了1,而数据库中存在表名为大写的表,这是 MySQL 的一个错误。要解决此问题,请先显示地将 lower_case_table_names 设为 false,然后将所有表名改为小写,最后再重新将 lower_case_table_names 设为 true。MySQL 3.23.56 / 4.0.11-gamma 版本已经修复了这个问题。

1.29 When I create a table or modify a column, I get an error and the columns are duplicated.

这可能是因为没有正确配置 Apache 而导致 PHP 无法正确解释 .php 文件。

该问题的产生,可能是因为在 Apache 的配置文件中显式地指定了两组互相冲突的设置:

SetOutputFilter PHP
SetInputFilter PHP

AddType application/x-httpd-php .php

上面两组设置,有一组位于 /etc/httpd/conf/httpd.conf 中,另一组位于 /etc/httpd/conf/addon-modules/php.conf 中。
推荐的设置是使用 AddType,所以,我们可以注释掉另外一组设置,就象这样:

#SetOutputFilter PHP
#SetInputFilter PHP

1.30 I get the error "navigation.php: Missing hash".

产正这个问题的原因是您的服务器上运行着 Turck MMCache,升级 MMCache 到 2.3.21 版本就可解决此问题。

1.31 phpMyAdmin 支持 PHP5 吗?

当然支持。

phpMyAdmin 3.0 及之后的版本只能在 PHP 5.2 或更新的版本上运行。对于旧版本的 PHP,请使用 phpMyAdmin 2.9 版本分支,这个分支版本目前还在维护中。

1.32 我能在 IIS 服务器上使用 HTTP 认证吗?

可以。我们在 IIS 5.1 上以 ISAPI 方式加载 PHP 4.3.9,使用 phpMyAdmin 2.6.1 版本进行测试,结果可以正常使用 phpMyAdmin。

  1. 请在 php.ini 文件中将 cgi.rfc2616_headers 设为0。
  2. 打开站点属性——>目录安全性——>匿名访问对话框,选中“启用匿名访问“,并去掉“基本身份验证“”集成 Windows 身份验证“和“Windows 域服务器的摘要试身份验证“以及其他的复选框。
  3. 自定义错误选项卡中,选中401;1401;5条目,然后点击设为默认按钮。

1.33 在 64 位系统上能正常使用 MySQLi 扩展吗?我的 PHP 版本是 5.0.4。

不能。在这种情况下 phpMyAdmin 会出错(" 调用了未定义的函数:pma_reloadnavigation")。请升级您的 PHP。

1.34 我能直接输入网址来显示数据库和表吗?

当然可以。您可以直接输入类似 http://server/phpMyAdmin/index.php?server=X&db=database&table=table&target=script 的 URL。其中,server 域指定了您在 config.inc.php 中设置的服务器编号。table 和 script 域是可选的。如果您想使用类似 http://server/phpMyAdmin/database[/table][/script] 这样的 URL,还需要进行一些额外的设置。下面给出在 Apache 上进行设置的方法: 首先请确定您已经在全局范围内启用了 Options FollowSymLinksAllowOverride FileInfo 功能,然后,在 phpMyAdmin 的目录配置下启用这两个功能。接着,在 phpMyAdmin 根目录下创建 .htaccess 文件,并将如下内容写入文件中:

RewriteEngine On
RewriteBase /path_to_phpMyAdmin
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([a-z_]+\.php)$ index.php?db=$1&table=$2&target=$3 [R]
RewriteRule ^([a-zA-Z0-9_]+)/([a-z_]+\.php)$ index.php?db=$1&target=$2 [R]
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)$ index.php?db=$1&table=$2 [R]
RewriteRule ^([a-zA-Z0-9_]+)$ index.php?db=$1 [R]

1.35 我将 PHP 配置为在 Apache 上以 CGI 方式运行。在这种情况下我能否使用 HTTP 认证?

可以,但您需要设置以下重写规则,以便将登录参数传送给 CGI

RewriteEngine On
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]

1.36 网页显示 "500 Internal Server Error",怎么办?

导致这种情况的原因有很多种,请查看您的服务器错误日志,其中可能包含了有关的错误信息。

1.37 加密密码功能不起作用。我使用 cookie 认证方式,phpMyAdmin 运行在服务器集群上。

如果您的集群中存在不同体系结构的系统,就会导致 PHP 无法使用 pack/unpack 函数进行正确的加解密操作。解决此问题的方法是使用 mcrypt 扩展。

1.38 我能在启用了 Suhosin 的服务器上使用 phpMyAdmin 吗?

Yes but the default configuration values of Suhosin are known to cause problems with some operations, for example editing a table with many columns and no primary key or with textual primary key.

Suhosin configuration might lead to malfunction in some cases and it can not be fully avoided as phpMyAdmin is kind of application which needs to transfer big amounts of columns in single HTTP request, what is something what Suhosin tries to prevent. Generally all suhosin.request.*, suhosin.post.* and suhosin.get.* directives can have negative effect on phpMyAdmin usability. You can always find in your error logs which limit did cause dropping of variable, so you can diagnose the problem and adjust matching configuration variable.

The default values for most Suhosin configuration options will work in most scenarios, however you might want to adjust at least following parameters:

You can also disable the warning using the SuhosinDisableWarning directive.

1.39 在使用 http 时我能正常登录,但是在切换到 https 方式后却不能登录了,这是怎么回事?

请确认您在 Apache 的配置文件中启用了 SSLOptions 和 StdEnvVars。具体请参考 http://httpd.apache.org/docs/2.0/mod/mod_ssl.html#ssloptions

1.40 When accessing phpMyAdmin via an Apache reverse proxy, cookie login does not work.

要在此方式下使用 cookie 认证,请确保将 Apache 设置为重写 set-cookie 头。
Apache 2.2 中给出了一个例子:

ProxyPass /mirror/foo/ http://backend.example.com/
ProxyPassReverse /mirror/foo/ http://backend.example.com/
ProxyPassReverseCookieDomain backend.example.com public.example.com 
ProxyPassReverseCookiePath / /mirror/foo/ 

注意:如果您的 URL 中带有 ~ 字符,请在 ProxyPassReverse 设置中将其转义为 %7E,就像下面那样:

ProxyPass /mirror/foo/ http://backend.example.com/~user/phpmyadmin
ProxyPassReverse /mirror/foo/
http://backend.example.com/%7Euser/phpmyadmin
ProxyPassReverseCookiePath /%7Euser/phpmyadmin /mirror/foo

更多信息请参考 http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

1.41 When I view a database and ask to see its privileges, I get an error about an unknown column.

MySQL 服务器的权限表没有更新,请运行 mysql_upgrade 命令来进行更新。

设置

2.1 页面显示 "Warning: Cannot add header information - headers already sent by ...",怎么办?

请检查 config.inc.php 文件,确保在 <?php 之前和 ?> 标签之后没有任何字符(包括空格、制表符以及空行等)。在 IIS 上使用 zipped 功能的用户同样向我们反馈了类似问题,在 libraries/Config.class.php 文件末尾有一个行尾符(ASCII 码为 0A),删除此字符即可解决问题。

2.2 phpMyAdmiin 无法连接到 MySQL 服务器,这是怎么回事?

这可能是因为您的 PHP 配置有误,或者您使用的登录名和密码错误。请写一个脚本,使用 mysql_connect 来尝试是否能连接到 MySQL 服务器,如果不能,就说明您可能没有将 MySQL 编译到 PHP 中,或者没有加载 MySQL 库。

2.3 网页显示 "Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111) ..." 这样的错误,怎么办?

Harald Legner 在邮件列表中为 RedHat 用户给出了一个解决方法:

在我的 RadHat 服务器上,MySQL 的 socket 是 /var/lib/mysql/mysql.sock,你应该能在 php.ini 文件中找到这样一行:

mysql.default_socket = /tmp/mysql.sock

将其修改为

mysql.default_socket = /var/lib/mysql/mysql.sock

之后重新启动 Apache,即可解决问题。

Brad Ummer 给出了另一种解决方案:

更多信息请参考 MySQL 文档.

2.4 我运行 phpMyAdmin 的时候,浏览器什么都没有显示,怎么办?

请在 phpMyAdmin 的配置文件中将 $cfg['OBGZip'] 显式地设为 FALSE,也许能解决此问题。
另外,请查看您的 PHP 版本号,如果版本号是类似 "4.0b..." 这样的系列,这说明您使用的 PHP 是一个测试版,使用测试版可能会产生一些奇怪的问题,请将 PHP 升级到稳定版。

2.5 当我删除记录、表或数据库时,浏览器总是显示 404 (找不到网页)。另外,如果使用 HTTP 或 cookie 认证方式,phpMyAdmin 会要求重新登录,这是怎么回事?

请在 phpMyAdmin 的配置文件中检查您是否显式地设定了 $cfg['PmaAbsoluteUri']

2.6 我试图连接到 MySQL 服务器时得到这样的错误:"Access denied for user: 'root@localhost' (Using password: YES)"。我对 MySQL 服务器端口进行了端口映射,将localhost 的端口转发到 MySQL 服务器端口上。

当您在自己的机器上(localhost)使用端口映射访问另一台机器上的 MySQL 时,MySQL 解析 localhost 主机名时将得到错误的结果。
Erik Wasser explains: The solution is: if your host is "localhost" MySQL (the command line tool mysql as well) always tries to use the socket connection for speeding up things. And that doesn't work in this configuration with port forwarding.
如果你使用 127.0.0.1 作为主机名,并使用将 MySQL 设置为使用 TCP 链接,就可以正常登录了。

2.7 如何创建和使用主题?

有关主题的设置项是:$cfg['ThemePath'], $cfg['ThemeManager'] 以及 $cfg['ThemeDefault']

请不要修改 $cfg['ThemePath'] 选项设置的目录下的文件结构,更不要删除这个目录。这个目录是 phpMyAdmin 的系统主题,如果一些主题缺少某些文件,phpMyAdmin 就会使用系统主题的文件替代之。

如果设置了 $cfg['ThemeManager'],您就可以在 phpMyAdmin 主页面中选择喜欢的主题。您使用的主题名字将会保存在 cookie 中。

要创建一个主题,请按照下面的方法进行操作:

在主题目录下有一个 info.inc.php 文件,其中包含了主题全名和主题版本号。主题版本号由您自行设定,不需要符合 phpMyAdmin 的版本号,只需要保证版本号是纯数字就行。拥有相同主版本号(generation number)的主题应该向下兼容。子版本号为2的主题应该能在使用子版本1主题的 phpMyAdmin 上正常显示。主版本号不相同的主题无须相互兼容。

如果您没有自己主题的图标和按钮,请删除您的主题目录下的 img 目录。phpMyAdmin 将使用默认的图标和按钮(位于 original 目录下的系统主题)。

2.8 我遇到了一个错误,错误提示 "缺少参数" 怎么办?

请先检查以下几点:

2.9 怎样设置才能显示上传进度条

要使用此功能,请在服务器上安装 APC 扩展或 uploadprogress,并启用 JSON 扩展。

如果使用 APC,请在 php.ini 中将 apc.rfc1867 设为 on

Known limitations

3.1 When using HTTP authentication, a user who logged out can not log in again in with the same nick.

这是 phpMyAdmin 的认证机制引起的问题。要解决此问题,请关闭所有已打开的 Windows 文件夹,然后重新登录 phpMyAdmin。

3.2 转储一个很大的表时,遇到了“超出内存限制“或“运行超时“错误。

压缩转储在内存中进行,而 PHP 对内存的使用有限制。从 2.5.4 版本开始,可以使用 Gzip/BZip2 导出来解决此问题。启用 $cfg['CompressOnFly'] 选项(默认已启用)。此方法不支持 Zip 导出,要进行 Zip 导出,需要使用其他的方法。

3.3 重命名 InnoDB 表名或其中的字段名时,外间关系会丢失。

这是一个 InnoDB 引擎的错误,请参考:http://bugs.mysql.com/bug.php?id=21704

3.4 我无法导入用 MySQL 服务器工具 mysqldump 生成的转储文件。

The problem is that older versions of mysqldump created invalid comments like this:

-- MySQL dump 8.22
--
-- Host: localhost Database: database
---------------------------------------------------------
-- Server version 3.23.54

错误的注释是那行由短横线组成的水平线,正确的注释应该是两个短横线后面跟一个空格。所以,要解决此问题,请在水平线的前两个短横线后加上一个空格,或直接在水平线的前面加上一个#符号,就像下面这样:
-- -------------------------------------------------------
或者
#---------------------------------------------------------

3.5 When using nested folders there are some multiple hierarchies displayed in a wrong manner?! ($cfg['LeftFrameTableSeparator'])

Please note that you should not use the separating string multiple times without any characters between them, or at the beginning/end of your table name. If you have to, think about using another TableSeparator or disabling that feature

3.6 What is currently not supported in phpMyAdmin about InnoDB?

In Relation view, being able to choose a table in another database, or having more than one index column in the foreign key.

In Query-by-example (Query), automatic generation of the query LEFT JOIN from the foreign table.

3.7 I have table with many (100+) columns and when I try to browse table I get series of errors like "Warning: unable to parse url". How can this be fixed?

Your table neither have a primary key nor an unique one, so we must use a long expression to identify this row. This causes problems to parse_url function. The workaround is to create a primary or unique key.

3.8 I cannot use (clickable) HTML-forms in columns where I put a MIME-Transformation onto!

Due to a surrounding form-container (for multi-row delete checkboxes), no nested forms can be put inside the table where phpMyAdmin displays the results. You can, however, use any form inside of a table if keep the parent form-container with the target to tbl_row_delete.php and just put your own input-elements inside. If you use a custom submit input field, the form will submit itself to the displaying page again, where you can validate the $HTTP_POST_VARS in a transformation. For a tutorial on how to effectively use transformations, see our Link section on the official phpMyAdmin-homepage.

3.9 I get error messages when using "--sql_mode=ANSI" for the MySQL server

When MySQL is running in ANSI-compatibility mode, there are some major differences in how SQL is structured (see http://dev.mysql.com/doc/mysql/en/ANSI_mode.html). Most important of all, the quote-character (") is interpreted as an identifier quote character and not as a string quote character, which makes many internal phpMyAdmin operations into invalid SQL statements. There is no workaround to this behaviour. News to this item will be posted in Bug report #816858

3.10 Homonyms and no primary key: When the results of a SELECT display more that one column with the same value (for example SELECT lastname from employees where firstname like 'A%' and two "Smith" values are displayed), if I click Edit I cannot be sure that I am editing the intended row.

Please make sure that your table has a primary key, so that phpMyAdmin can use it for the Edit and Delete links.

3.11 The number of records for InnoDB tables is not correct.

phpMyAdmin uses a quick method to get the row count, and this method only returns an approximate count in the case of InnoDB tables. See $cfg['MaxExactCount'] for a way to modify those results, but this could have a serious impact on performance.

3.12 What are the phpMyAdmin limitations for MySQL 3?

The number of records in queries containing COUNT and GROUP BY is not correctly calculated. Also, sorting results of a query like "SELECT * from table GROUP BY" ... is problematic.

3.13 I get an error when entering USE followed by a db name containing an hyphen.

The tests I have made with current MySQL 4.1.11 API shows that the API does not accept this syntax for the USE command. Enclosing the db name with backquotes works. For further confusion, no backquotes are needed with command-line mysql.

3.14 I am not able to browse a table when I don't have the right to SELECT one of the columns.

This has been a known limitation of phpMyAdmin since the beginning and it's not likely to be solved in the future.

3.15 When I import an Excel spreadsheet, some cells with calculations do not display correctly.

phpMyAdmin uses the PHPExcel library to parse Excel XLS and XLSX spreadsheets. Therefore, any limitations that are listed on their page regarding Excel calculations will also apply here.

PHPExcel will be kept up to date so as to make all improvements available to phpMyAdmin users.

3.16 When I compress (gzip, bzip2, zip) an Excel workbook and attempt to import it, nothing happens.

Since Excel XLSX workbooks are already compressed, there is often times only a small benefit from compressing them yet again. Support for compressed Excel XLSX and XLS workbooks may be added in the future.

3.17 When I import an Excel spreadsheet, my custom cell types are not represented as they are in Excel.

Excel's internal representation of custom cell types is rather muddled (especially in Excel 97-2003 binary XLS files). If possible, consider using a built-in type. These are almost always guarenteed to import correctly.

3.18 When I import a CSV file that contains multiple tables, they are lumped together into a single table.

There is no reliable way to differetiate tables in CSV format. For the time being, you will have to break apart CSV files containing multiple tables.

3.19 When I import a file and have phpMyAdmin determine the appropriate data structure it only uses int, decimal, and varchar types.

Currently, the import type-detection system can only assign these MySQL types to columns. In future, more will likely be added but for the time being you will have to edit the structure to your liking post-import.

Also, you should note the fact that phpMyAdmin will use the size of the largest item in any given column as the column size for the appropriate type. If you know you will be adding larger items to that column then you should manually adjust the column sizes accordingly. This is done for the sake of efficiency.

ISPs, multi-user installations

4.1 I'm an ISP. Can I setup one central copy of phpMyAdmin or do I need to install it for each customer.

Since version 2.0.3, you can setup a central copy of phpMyAdmin for all your users. The development of this feature was kindly sponsored by NetCologne GmbH. This requires a properly setup MySQL user management and phpMyAdmin HTTP or cookie authentication. See the install section on "Using HTTP authentication".

4.2 What's the preferred way of making phpMyAdmin secure against evil access.

This depends on your system.
If you're running a server which cannot be accessed by other people, it's sufficient to use the directory protection bundled with your webserver (with Apache you can use .htaccess files, for example).
If other people have telnet access to your server, you should use phpMyAdmin's HTTP or cookie authentication features.

Suggestions:

4.3 I get errors about not being able to include a file in /lang or in /libraries.

Check php.ini, or ask your sysadmin to check it. The include_path must contain "." somewhere in it, and open_basedir, if used, must contain "." and "./lang" to allow normal operation of phpMyAdmin.

4.4 phpMyAdmin always gives "Access denied" when using HTTP authentication.

This could happen for several reasons:

4.5 Is it possible to let users create their own databases?

Starting with 2.2.5, in the user management page, you can enter a wildcard database name for a user (for example "joe%"), and put the privileges you want. For example, adding SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER would let a user create/manage his/her database(s).

4.6 How can I use the Host-based authentication additions?

If you have existing rules from an old .htaccess file, you can take them and add a username between the 'deny'/'allow' and 'from' strings. Using the username wildcard of '%' would be a major benefit here if your installation is suited to using it. Then you can just add those updated lines into the $cfg['Servers'][$i]['AllowDeny']['rules'] array.

If you want a pre-made sample, you can try this fragment. It stops the 'root' user from logging in from any networks other than the private network IP blocks.

//block root from logging in except from the private networks
$cfg['Servers'][$i]['AllowDeny']['order'] = 'deny,allow';
$cfg['Servers'][$i]['AllowDeny']['rules'] = array(
    'deny root from all',
    'allow root from localhost',
    'allow root from 10.0.0.0/8',
    'allow root from 192.168.0.0/16',
    'allow root from 172.16.0.0/12',
    );

4.7 Authentication window is displayed more than once, why?

This happens if you are using a URL to start phpMyAdmin which is different than the one set in your $cfg['PmaAbsoluteUri']. For example, a missing "www", or entering with an IP address while a domain name is defined in the config file.

4.8 Which parameters can I use in the URL that starts phpMyAdmin?

When starting phpMyAdmin, you can use the db, pma_username, pma_password and server parameters. This last one can contain either the numeric host index (from $i of the configuration file) or one of the host names present in the configuration file. Using pma_username and pma_password has been tested along with the usage of 'cookie' auth_type.

Browsers or client OS

5.1 I get an out of memory error, and my controls are non-functional, when trying to create a table with more than 14 columns.

We could reproduce this problem only under Win98/98SE. Testing under WinNT4 or Win2K, we could easily create more than 60 columns.
A workaround is to create a smaller number of columns, then come back to your table properties and add the other columns.

5.2 With Xitami 2.5b4, phpMyAdmin won't process form fields.

This is not a phpMyAdmin problem but a Xitami known bug: you'll face it with each script/website that use forms.
Upgrade or downgrade your Xitami server.

5.3 I have problems dumping tables with Konqueror (phpMyAdmin 2.2.2).

With Konqueror 2.1.1: plain dumps, zip and GZip dumps work ok, except that the proposed file name for the dump is always 'tbl_dump.php'. Bzip2 dumps don't seem to work.
With Konqueror 2.2.1: plain dumps work; zip dumps are placed into the user's temporary directory, so they must be moved before closing Konqueror, or else they disappear. GZip dumps give an error message.
Testing needs to be done for Konqueror 2.2.2.

5.4 I can't use the cookie authentication mode because Internet Explorer never stores the cookies.

MS Internet Explorer seems to be really buggy about cookies, at least till version 6.

5.5 In Internet Explorer 5.0, I get JavaScript errors when browsing my rows.

Upgrade to at least Internet Explorer 5.5 SP2.

5.6 In Internet Explorer 5.0, 5.5 or 6.0, I get an error (like "Page not found") when trying to modify a row in a table with many columns, or with a text column

Your table neither have a primary key nor an unique one, so we must use a long URL to identify this row. There is a limit on the length of the URL in those browsers, and this not happen in Netscape, for example. The workaround is to create a primary or unique key, or use another browser.

5.7 I refresh (reload) my browser, and come back to the welcome page.

Some browsers support right-clicking into the frame you want to refresh, just do this in the right frame.

5.8 With Mozilla 0.9.7 I have problems sending a query modified in the query box.

Looks like a Mozilla bug: 0.9.6 was OK. We will keep an eye on future Mozilla versions.

5.9 With Mozilla 0.9.? to 1.0 and Netscape 7.0-PR1 I can't type a whitespace in the SQL-Query edit area: the page scrolls down.

This is a Mozilla bug (see bug #26882 at BugZilla).

5.10 With Netscape 4.75 I get empty rows between each row of data in a CSV exported file.

This is a known Netscape 4.75 bug: it adds some line feeds when exporting data in octet-stream mode. Since we can't detect the specific Netscape version, we cannot workaround this bug.

5.11 Extended-ASCII characters like German umlauts are displayed wrong.

Please ensure that you have set your browser's character set to the one of the language file you have selected on phpMyAdmin's start page. Alternatively, you can try the auto detection mode that is supported by the recent versions of the most browsers.

5.12 Mac OS X: Safari browser changes special characters to "?".

This issue has been reported by a OS X user, who adds that Chimera, Netscape and Mozilla do not have this problem.

5.13 With Internet Explorer 5.5 or 6, and HTTP authentication type, I cannot manage two servers: I log in to the first one, then the other one, but if I switch back to the first, I have to log in on each operation.

This is a bug in Internet Explorer, other browsers do not behave this way.

5.14 Using Opera6, I can manage to get to the authentication, but nothing happens after that, only a blank screen.

Please upgrade to Opera7 at least.

5.15 I have display problems with Safari.

Please upgrade to at least version 1.2.3.

5.16 With Internet Explorer, I get "Access is denied" Javascript errors. Or I cannot make phpMyAdmin work under Windows.

Please check the following points:

5.17 With Firefox, I cannot delete rows of data or drop a database.

Many users have confirmed that the Tabbrowser Extensions plugin they installed in their Firefox is causing the problem.

5.18 With Konqueror 4.2.x an invalid LIMIT clause is generated when I browse a table.

This happens only when both of these conditions are met: using the http authentication mode and register_globals being set to On on the server. It seems to be a browser-specific problem; meanwhile use the cookie authentication mode.

Using phpMyAdmin

6.1 I can't insert new rows into a table / I can't create a table - MySQL brings up a SQL-error.

Examine the SQL error with care. Often the problem is caused by specifying a wrong column-type.
Common errors include:

Also, look at the syntax chapter in the MySQL manual to confirm that your syntax is correct.

6.2 When I create a table, I set an index for two columns and phpMyAdmin generates only one index with those two columns.

This is the way to create a multi-columns index. If you want two indexes, create the first one when creating the table, save, then display the table properties and click the Index link to create the other index.

6.3 How can I insert a null value into my table?

Since version 2.2.3, you have a checkbox for each column that can be null. Before 2.2.3, you had to enter "null", without the quotes, as the column's value. Since version 2.5.5, you have to use the checkbox to get a real NULL value, so if you enter "NULL" this means you want a literal NULL in the column, and not a NULL value (this works in PHP4).

6.4 How can I backup my database or table?

Click on a database or table name in the left frame, the properties will be displayed. Then on the menu, click "Export", you can dump the structure, the data, or both. This will generate standard SQL statements that can be used to recreate your database/table.

You will need to choose "Save as file", so that phpMyAdmin can transmit the resulting dump to your station. Depending on your PHP configuration, you will see options to compress the dump. See also the $cfg['ExecTimeLimit'] configuration variable.

For additional help on this subject, look for the word "dump" in this document.

6.5 How can I restore (upload) my database or table using a dump? How can I run a ".sql" file?

Click on a database name in the left frame, the properties will be displayed. Select "Import" from the list of tabs in the right–hand frame (or "SQL" if your phpMyAdmin version is previous to 2.7.0). In the "Location of the text file" section, type in the path to your dump filename, or use the Browse button. Then click Go.

With version 2.7.0, the import engine has been re–written, if possible it is suggested that you upgrade to take advantage of the new features.

For additional help on this subject, look for the word "upload" in this document.

6.6 How can I use the relation table in Query-by-example?

Here is an example with the tables persons, towns and countries, all located in the database mydb. If you don't have a pma_relation table, create it as explained in the configuration section. Then create the example tables:

CREATE TABLE REL_countries (
    country_code char(1) NOT NULL default '',
    description varchar(10) NOT NULL default '',
    PRIMARY KEY (country_code)
) TYPE=MyISAM;

INSERT INTO REL_countries VALUES ('C', 'Canada');

CREATE TABLE REL_persons (
    id tinyint(4) NOT NULL auto_increment,
    person_name varchar(32) NOT NULL default '',
    town_code varchar(5) default '0',
    country_code char(1) NOT NULL default '',
    PRIMARY KEY (id)
) TYPE=MyISAM;

INSERT INTO REL_persons VALUES (11, 'Marc', 'S', '');
INSERT INTO REL_persons VALUES (15, 'Paul', 'S', 'C');

CREATE TABLE REL_towns (
    town_code varchar(5) NOT NULL default '0',
    description varchar(30) NOT NULL default '',
    PRIMARY KEY (town_code)
) TYPE=MyISAM;

INSERT INTO REL_towns VALUES ('S', 'Sherbrooke');
INSERT INTO REL_towns VALUES ('M', 'Montréal');

To setup appropriate links and display information:

Then test like this:

6.7 How can I use the "display column" feature?

Starting from the previous example, create the pma_table_info as explained in the configuration section, then browse your persons table, and move the mouse over a town code or country code.

See also FAQ 6.21 for an additional feature that "display column" enables: drop-down list of possible values.

6.8 How can I produce a PDF schema of my database?

First the configuration variables "relation", "table_coords" and "pdf_pages" have to be filled in.

Then you need to think about your schema layout. Which tables will go on which pages?

6.9 phpMyAdmin is changing the type of one of my columns!

No, it's MySQL that is doing silent column type changing.

6.10 When creating a privilege, what happens with underscores in the database name?

If you do not put a backslash before the underscore, this is a wildcard grant, and the underscore means "any character". So, if the database name is "john_db", the user would get rights to john1db, john2db ...

If you put a backslash before the underscore, it means that the database name will have a real underscore.

6.11 What is the curious symbol ø in the statistics pages?

It means "average".

6.12 I want to understand some Export options.

Structure:

Data:

6.13 I would like to create a database with a dot in its name.

This is a bad idea, because in MySQL the syntax "database.table" is the normal way to reference a database and table name. Worse, MySQL will usually let you create a database with a dot, but then you cannot work with it, nor delete it.

6.14 How do I set up the SQL Validator?

To use SQL Validator, you need PHP with XML, PCRE and PEAR support. In addition you need a SOAP support, either as a PHP extension or as a PEAR SOAP module.

To install PEAR SOAP module, run "pear install Net_Socket Net_URL HTTP_Request Mail_Mime Net_DIME SOAP" to get the necessary PEAR modules for usage.

If you use the Validator, you should be aware that any SQL statement you submit will be stored anonymously (database/table/column names, strings, numbers replaced with generic values). The Mimer SQL Validator itself, is © 2001 Upright Database Technology. We utilize it as free SOAP service.

6.15 I want to add a BLOB column and put an index on it, but MySQL says "BLOB column '...' used in key specification without a key length".

The right way to do this, is to create the column without any indexes, then display the table structure and use the "Create an index" dialog. On this page, you will be able to choose your BLOB column, and set a size to the index, which is the condition to create an index on a BLOB column.

6.16 How can I simply move in page with plenty editing fields?

You can use Ctrl+arrows (Option+Arrows in Safari) for moving on most pages with many editing fields (table structure changes, row editing, etc.) (must be enabled in configuration - see. $cfg['CtrlArrowsMoving']). You can also have a look at the directive $cfg['DefaultPropDisplay'] ('vertical') and see if this eases up editing for you.

6.17 Transformations: I can't enter my own mimetype! WTF is this feature then useful for?

Slow down :). Defining mimetypes is of no use, if you can't put transformations on them. Otherwise you could just put a comment on the column. Because entering your own mimetype will cause serious syntax checking issues and validation, this introduces a high-risk false-user-input situation. Instead you have to initialize mimetypes using functions or empty mimetype definitions.
Plus, you have a whole overview of available mimetypes. Who knows all those mimetypes by heart so he/she can enter it at will?

6.18 Bookmarks: Where can I store bookmarks? Why can't I see any bookmarks below the query box? What is this variable for?

Any query you have executed can be stored as a bookmark on the page where the results are displayed. You will find a button labeled 'Bookmark this query' just at the end of the page.
As soon as you have stored a bookmark, it is related to the database you run the query on. You can now access a bookmark dropdown on each page, the query box appears on for that database.

Since phpMyAdmin 2.5.0 you are also able to store variables for the bookmarks. Just use the string /*[VARIABLE]*/ anywhere in your query. Everything which is put into the value input box on the query box page will replace the string "/*[VARIABLE]*/" in your stored query. Just be aware of that you HAVE to create a valid query, otherwise your query won't be even able to be stored in the database.
Also remember, that everything else inside the /*[VARIABLE]*/ string for your query will remain the way it is, but will be stripped of the /**/ chars. So you can use:

/*, [VARIABLE] AS myname */

which will be expanded to

, VARIABLE as myname

in your query, where VARIABLE is the string you entered in the input box. If an empty string is provided, no replacements are made.

A more complex example. Say you have stored this query:

SELECT Name, Address FROM addresses WHERE 1 /* AND Name LIKE '%[VARIABLE]%' */

Say, you now enter "phpMyAdmin" as the variable for the stored query, the full query will be:

SELECT Name, Address FROM addresses WHERE 1 AND Name LIKE '%phpMyAdmin%'

You can use multiple occurrences of /*[VARIABLE]*/ in a single query.
NOTE THE ABSENCE OF SPACES inside the "/**/" construct. Any spaces inserted there will be later also inserted as spaces in your query and may lead to unexpected results especially when using the variable expansion inside of a "LIKE ''" expression.
Your initial query which is going to be stored as a bookmark has to yield at least one result row so you can store the bookmark. You may have that to work around using well positioned "/**/" comments.

6.19 How can I create simple LATEX document to include exported table?

You can simply include table in your LATEX documents, minimal sample document should look like following one (assuming you have table exported in file table.tex):

\documentclass{article} % or any class you want
\usepackage{longtable}  % for displaying table
\begin{document}        % start of document
\include{table}         % including exported table
\end{document}          % end of document

6.20 I see a lot of databases which are not mine, and cannot access them.

You have one of these global privileges: CREATE TEMPORARY TABLES, SHOW DATABASES, LOCK TABLES. Those privileges also enable users to see all the database names. See this bug report.

So if your users do not need those privileges, you can remove them and their databases list will shorten.

6.21 In edit/insert mode, how can I see a list of possible values for a column, based on some foreign table?

You have to setup appropriate links between the tables, and also setup the "display column" in the foreign table. See FAQ 6.6 for an example. Then, if there are 100 values or less in the foreign table, a drop-down list of values will be available. You will see two lists of values, the first list containing the key and the display column, the second list containing the display column and the key. The reason for this is to be able to type the first letter of either the key or the display column.

For 100 values or more, a distinct window will appear, to browse foreign key values and choose one. To change the default limit of 100, see $cfg['ForeignKeyMaxLimit'].

6.22 Bookmarks: Can I execute a default bookmark automatically when entering Browse mode for a table?

Yes. If a bookmark has the same label as a table name, it will be executed.

6.23 Export: I heard phpMyAdmin can export Microsoft Excel files, how can I enable that?

You can use CSV for Microsoft Excel, which works out of the box, but phpMyAdmin supports direct export to Microsoft Excel version 97 and newer. For this to work, you need to set $cfg['TempDir'] to a place where the web server user can write (for example './tmp').

To create the temporary directory on a UNIX-based system, you can do:

cd phpMyAdmin
mkdir tmp
chmod o+rwx tmp

6.24 Now that phpMyAdmin supports native MySQL 4.1.x column comments, what happens to my column comments stored in pmadb?

Automatic migration of a table's pmadb-style column comments to the native ones is done whenever you enter Structure page for this table.

6.25 How does BLOB streaming work in phpMyAdmin?

For general information about BLOB streaming on MySQL, visit blobstreaming.org. You need the following components:

Here are details about configuration and operation:

  1. In config.inc.php your host should be defined with a FQDN (fully qualified domain name) instead of "localhost".
  2. Ensure that your target table is under the PBXT storage engine and has a LONGBLOB column (which must be nullable if you want to remove the BLOB reference from it).
  3. When you insert or update a row in this table, put a checkmark on the "Upload to BLOB repository" optional choice; otherwise, the upload will be done directly in your LONGBLOB column instead of the repository.
  4. Finally when you browse your table, you'll see in your column a link to stream your data, for example "View image". A header containing the correct MIME-type will be sent to your browser; this MIME-type was stored at upload time.

6.26 How can I select a range of rows?

Click the first row of the range, hold the shift key and click the last row of the range. This works everywhere you see rows, for example in Browse mode or on the Structure page.

6.27 What format strings can I use?

In all places where phpMyAdmin accepts format strings, you can use @VARIABLE@ expansion and strftime format strings. The expanded variables depend on a context (for example, if you haven't chosen a table, you can not get the table name), but the following variables can be used:

@HTTP_HOST@
HTTP host that runs phpMyAdmin
@SERVER@
MySQL server name
@VERBOSE@
Verbose MySQL server name as defined in server configuration
@VSERVER@
Verbose MySQL server name if set, otherwise normal
@DATABASE@
Currently opened database
@TABLE@
Currently opened table
@FIELDS@
Fields of currently opened table
@PHPMYADMIN@
phpMyAdmin with version

6.28 How can I easily edit relational schema for export?

By clicking on the button 'toggle scratchboard' on the page where you edit x/y coordinates of those elements you can activate a scratchboard where all your elements are placed. By clicking on an element, you can move them around in the pre-defined area and the x/y coordinates will get updated dynamically. Likewise, when entering a new position directly into the input field, the new position in the scratchboard changes after your cursor leaves the input field.

You have to click on the 'OK'-button below the tables to save the new positions. If you want to place a new element, first add it to the table of elements and then you can drag the new element around.

By changing the paper size and the orientation you can change the size of the scratchboard as well. You can do so by just changing the dropdown field below, and the scratchboard will resize automatically, without interfering with the current placement of the elements.

If ever an element gets out of range you can either enlarge the paper size or click on the 'reset' button to place all elements below each other.

6.28 Why can't I get a chart from my query result table?

Not every table can be put to the chart. Only tables with one, two or three columns can be visualised as a chart. Moreover the table must be in a special format for chart script to understand it. Currently supported formats can be found in the wiki.

phpMyAdmin project

7.1 I have found a bug. How do I inform developers?

Our Bug Tracker is located at http://sf.net/projects/phpmyadmin/ under the Bugs section.

But please first discuss your bug with other users:
https://sourceforge.net/projects/phpmyadmin/forums.

7.2 I want to translate the messages to a new language or upgrade an existing language, where do I start?

Always use latest Git version of the po file to translate. You can optionally translate online at our translation server where you can also get the latest po files and merge them with your translations. For creating a new translation simply use po/phpmyadmin.pot and generate po/LANG_CODE.po for your language (you can use msginit -i po/phpmyadmin.pot -l LANG_CODE --no-translator -o po/LANG_CODE.po to do this) or ask on the mailing list to add the translation to the web interface. More details are available on our wiki.

Please note that we try not to use HTML entities like &eacute; in the translations, since we define the right character set in the file. With HTML entities, the text on JavaScript messages would not display correctly. However there are some entities that need to be there: quotes, non-breakable spaces, ampersands, less than, greater than.

You can then put your translations, as a zip file to avoid losing special characters, on the sourceforge.net translation tracker.

It would be a good idea to subscribe to the phpmyadmin-translators mailing list, because this is where we ask for translations of new messages.

Documentation is being translated using po4a and gettext (see documentation for existing translations). To start, checkout localized_docs/po from Git, or just go to the translation server and translate it online. If your language is missing, just contact Michal Čihař; he will add it. If you prefer to directly translate the po files, please put updated ones into our translation tracker.

7.3 I would like to help out with the development of phpMyAdmin. How should I proceed?

The following method is preferred for new developers:

  1. fetch the current git repository over anonymous git:
    git clone git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
  2. add your stuff
  3. generate patch with your changes: git diff > xxx.diff
  4. submit your patch via the patch tracker of the phpMyAdmin project.

More details on git are available on our wiki.

Write access to the repository is granted only to experienced developers who have already contributed something useful to phpMyAdmin.
Also, have a look at the Developers section.

安全

8.1 Where can I get information about the security alerts issued for phpMyAdmin?

Please refer to http://www.phpmyadmin.net/home_page/security.php

8.2 How can I protect phpMyAdmin against brute force attacks?

If you use Apache web server, phpMyAdmin exports information about authentication to the Apache environment and it can be used in Apache logs. Currently there are two variables available:

userID
User name of currently active user (he does not have to be logged in).
userStatus
Status of currently active user, one of ok (user is logged in), mysql-denied (MySQL denied user login), allow-denied (user denied by allow/deny rules), root-denied (root is denied in configuration), empty-denied (empty password is denied).

LogFormat directive for Apache can look like following:

LogFormat "%h %l %u %t \"%r\" %>s %b \
\"%{Referer}i\" \"%{User-Agent}i\" %{userID}n %{userStatus}n"   pma_combined

You can then use any log analyzing tools to detect possible break-in attempts.

Synchronization

9.1 How can I synchronize two databases/tables in phpMyAdmin?

You can now synchronize databases/tables in phpMyAdmin using the Synchronize feature. It allows you to connect to local as well as remote servers. This requires you to enter server host name, username, password, port and the name of the database. Therefore you can now synchronize your databases placed on the same server or some remote server.

This feature is helpful for developers who need to replicate their database’s structure as well as data. Moreover, this feature not only helps replication but also facilitates the user to keep his/her database in sync with another database. Other than the full database, certain tables of the databases can also be synchronized.

You need to fill in the host name of the server, the username and password of an user account already there in MySQL. Port is by default populated with 3306 (MySQL default port). Then the name of the database should be mentioned at the end. All the information other than the port needs to be filled explicitly for the source as well as target servers.

After successfully passing through the authentication phase, the source and target database table names will be displayed. It will be a tabular representation.

On the left, are listed the source database table names. Some of the names have a + plus sign preceding them. This shows that these tables are only present in source database and they need to be added to the target database in order to synchronize the target database. The tables whose names are not preceded by a + sign are already present in the target database.

On the right, are listed the target database table names. There are few table names that have (not present) appended after their names. This means that these tables are to be created in target database in order to synchronize target database with source database. Some table names have a - minus sign preceding them. This shows that these tables are only present in target database and they will remain unchanged in the target database. The column in the middle shows the difference between the source and target corresponding tables.

The difference is depicted by the red and green buttons with S and D letters, indicating that either Structure or Data are not up to date. By clicking on them, they will turn grey, what means that they will be synchronized.

开发信息

phpMyAdmin 是开源的,我们欢迎您的参与。很多优秀的功能都不是我们写的,你同样可以帮助 phpMyAdmin 变成更加实用的工具。

如果您正打算贡献源代码,请阅读以下信息:

Copyright (C) 1998-2000 Tobias Ratschiller <tobias_at_ratschiller.com>
Copyright (C) 2001-2010 Marc Delisle <marc_at_infomarc.info>
                        Olivier Müller <om_at_omnis.ch>
                        Robin Johnson <robbat2_at_users.sourceforge.net>
                        Alexander M. Turek <me_at_derrabus.de>
                        Michal Čihař <michal_at_cihar.com>
                        Garvin Hicking <me_at_supergarv.de>
                        Michael Keck <mkkeck_at_users.sourceforge.net>
                        Sebastian Mendel <cybot_tm_at_users.sourceforge.net>
                        [check credits for more details]

本软件是自由软件,你可以在自由软件基金会发布的 GNU 通用公共许可协议第 2 版的许可下重新修改并/或发布。

本软件因希望能对大家有用而发布,但没有任何担保,也没有任何适销性或针对特定用途的隐含的担保。参见 GNU 通用公共许可协议获得详细信息。

你应该在获得此软件的同时收到一份 GNU 通用公共许可协议的副本如果没有,请致函 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

鸣谢

按时间先后顺序

And also to the following people who have contributed minor changes, enhancements, bugfixes or support for a new language since version 2.1.0:

Bora Alioglu, Ricardo ?, Sven-Erik Andersen, Alessandro Astarita, Péter Bakondy, Borges Botelho, Olivier Bussier, Neil Darlow, Mats Engstrom, Ian Davidson, Laurent Dhima, Kristof Hamann, Thomas Kläger, Lubos Klokner, Martin Marconcini, Girish Nair, David Nordenberg, Andreas Pauley, Bernard M. Piller, Laurent Haas, "Sakamoto", Yuval Sarna, www.securereality.com.au, Alexis Soulard, Alvar Soome, Siu Sun, Peter Svec, Michael Tacelosky, Rachim Tamsjadi, Kositer Uros, Luís V., Martijn W. van der Lee, Algis Vainauskas, Daniel Villanueva, Vinay, Ignacio Vazquez-Abrams, Chee Wai, Jakub Wilk, Thomas Michael Winningham, Vilius Zigmantas, "Manuzhai".

Original Credits of Version 2.1.0

This work is based on Peter Kuppelwieser's MySQL-Webadmin. It was his idea to create a web-based interface to MySQL using PHP3. Although I have not used any of his source-code, there are some concepts I've borrowed from him. phpMyAdmin was created because Peter told me he wasn't going to further develop his (great) tool.

Thanks go to

The following people have contributed minor changes, enhancements, bugfixes or support for a new language:

Jim Kraai, Jordi Bruguera, Miquel Obrador, Geert Lund, Thomas Kleemann, Alexander Leidinger, Kiko Albiol, Daniel C. Chao, Pavel Piankov, Sascha Kettler, Joe Pruett, Renato Lins, Mark Kronsbein, Jannis Hermanns, G. Wieggers.

And thanks to everyone else who sent me email with suggestions, bug-reports and or just some feedback.

词汇表

源自维基百科,自由的百科全书