欢迎阅读 phpMyAdmin 文档!¶
目录:
介绍¶
phpMyAdmin 是由 PHP 编写的用于管理 MySQL 或 MariaDB 数据服务器的免费软件工具。您可以使用 phpMyAdmin 来实行大部分管理任务,如创建数据库、运行查询和添加用户账户。
支持的功能¶
目前 phpMyAdmin 能:
- 创建、浏览、编辑和删除数据库、表、视图、字段及索引
- 通过存储过程或查询显示多种结果集
- 创建、复制、删除、改名和修改数据库、表、字段及索引
- 在服务器设置中提供对如何维护服务器、数据库和表的建议
- 执行、编辑并将任意 SQL 语句甚至批量查询加入书签
- 载入文本文件至表
- 创建 [1] 和读取表的转储
- 导出 [1] 数据为多种格式: CSV、 XML、 PDF、 ISO/IEC 26300 - OpenDocument 文本和电子表格、微软 Word 2000 和 LATEX 格式
- 从 OpenDocument 电子表格、 XML 、 CSV 和 SQL 文件中导入数据和 MySQL 结构
- 管理多台服务器
- 添加、编辑和删除 MySQL 用户和权限
- 检查 MyISAM 表的参照完整性
- 根据您数据库的设计创建 PDF 图
- 在全部或部分数据库中搜索
- 通过一系列预定义函数转换现有数据至任意形式,如将 BLOB 数据显示为图像或下载链接
- 追踪数据库、表和视图的变化
- 支持 InnoDB 表和外键
- 支持 mysqli,改进的 MySQL 扩展,参见 1.17.1 phpMyAdmin 支持哪些数据库版本?
- 创建、编辑、调用、导出和删除存储过程及函数
- 创建、编辑、导出和删除事件及触发器
- 支持多达 80 种语言
快捷键¶
目前 phpMyAdmin 支持以下快捷键:
- k - 切换控制台显示
- h - 前往主页
- s - 打开设置
- d + s - 前往数据库结构(如果你在数据库相关页面)
- d + f - 查找数据库(如果你在数据库相关页面)
- t + s - 前往表格结构(如果你在表格相关页面)
- t + f - 表格查询(如果你在表格相关页面)
- backspace - 回到之前的页面。
需求¶
PHP¶
- You need PHP 8.1.2 or newer, with
session
support, the Standard PHP Library (SPL) extension, hash, ctype, and JSON support. - 为性能需求,强烈推荐使用
mbstring
扩展(参见 mbstring)。 - 要支持上传 ZIP 文件,您需要 PHP
zip
扩展。 - 要支持内嵌 JPEG 图像(“image/jpeg: inline”)的等比缩略图,您需要 PHP GD2 支持。
- 当使用 cookie 认证(默认)时,强烈建议使用 openssl 扩展。
- 要支持上传进度条,参见 2.9 怎样设置才能显示上传进度条?。
- 要支持导入 XML 和开放文档电子表格,您需要 libxml 扩展。
- 要在登陆页支持使用 reCAPTCHA,您需要 openssl 扩展。
- 为支持显示 phpMyAdmin 的最新版本,您需要在
php.ini
中启用allow_url_open
或安装 curl 扩展。
网页浏览器¶
您需要一个支持 cookies 和启用了 JavaScript 的网页浏览器来访问 phpMyAdmin。
您需要支持 Bootstrap 4.5 的浏览器,参见 <https://getbootstrap.com/docs/4.5/getting-started/browsers-devices/>。
在 5.2.0 版更改: 您需要支持 Bootstrap 5.0 的浏览器,参见 <https://getbootstrap.com/docs/5.0/getting-started/browsers-devices/>。
安装¶
phpMyAdmin 不会在 MySQL 数据库服务器上应用任何特别的安全措施。正确设置 MySQL 数据库的权限是系统管理员应该做的。phpMyAdmin 的 用户 页面可以帮助系统管理员设置权限。
Linux发行版¶
phpMyAdmin包含在大多数Linux发行版中。建议尽可能使用分发包 - 它们通常提供与您的发行版的集成,并且您将自动从您的发行版中获取安全更新。
Debian 和 Ubuntu¶
大多数 Debian 和 Ubuntu 版本中包含了 phpMyAdmin 软件包,但要注意配置文件是在 /etc/phpmyadmin
中维护的,并且可能在某些方面与官方的phpMyAdmin文档有所不同。具体来说它包括:
- Web 服务器的配置(适用于Apache和lighttpd)。
- 使用dbconfig-common创建 phpMyAdmin配置存储。
- 保护设置脚本,请参阅: Debian、Ubuntu及其衍生产品的安装脚本。
更多安装 Debian 或 Ubuntu 软件包的信息在`我们的 wiki <https://github.com/phpmyadmin/phpmyadmin/wiki/DebianUbuntu>`_ 页面有进一步的说明。
参见
更多信息可以在 README.Debian 中找到(它通过包安装到了 /usr/share/doc/phmyadmin/README.Debian
)。
OpenSUSE¶
OpenSUSE已经附带了 phpMyAdmin 包,只需从 openSUSE Build Service 获取包。
Gentoo¶
Gentoo提供phpMyAdmin软件包,包括成品配置和 webapp-config
配置。使用 emerge dev-db/phpmyadmin
进行安装。
Mandriva¶
Mandriva在 contrib
分支中搭载着 phpMyAdmin 软件包,可以从通常的控制中心中安装。
Fedora¶
Fedora 搭载有phpMyAdmin软件包,但注意配置文件放在 /etc/phpMyAdmin/
中,并且可能会和官方phpMyAdmin文档有不同。
红帽 Linux 企业版¶
红帽 Linux 企业版本身以及 CentOS 这样的衍生产品并没有搭载 phpMyAdmin,但 Fedora 驱动的软件库 Extra Packages for Enterprise Linux (EPEL) 包含了它,如果 它被启用 。但要注意的是,配置文件在 /etc/phpMyAdmin/
中维护,可能在某些方面与官方的 phpMyAdmin 文档不同。
Windows安装¶
在Windows上获得phpMyAdmin最容易的方法是使用带有phpMyAdmin、数据库和网络服务器的第三方产品,比如 XAMPP 。
您可以从 维基百科(英文) 中找到更多这样的选择。
从Git安装¶
为了从 Git 安装,您需要一些支持的应用:
你可以从 https://github.com/phpmyadmin/phpmyadmin.git
克隆当前的phpMyAdmin源代码:
git clone https://github.com/phpmyadmin/phpmyadmin.git
此外,您需要使用 Composer 来安装依赖项:
composer update
如果您不打算开发,可以通过调用以下命令跳过开发人员工具的安装:
composer update --no-dev
最终,你需要用 Yarn 安装一些 JavaScript 依赖:
yarn install --production
用Composer安装¶
您可以使用 Composer tool 安装phpMyAdmin,因为4.7.0版本会自动镜像到默认的 Packagist 存储库。
注解
Composer存储库的内容是自动生成的,因此内容不必与下载tarball时的内容完全相同。但是应该没有功能上的差异。
要安装phpMyAdmin,只需运行:
composer create-project phpmyadmin/phpmyadmin
或者,您可以使用我们自己的composer存储库,其中包含发行版tar包,可从<https://www.phpmyadmin.net/packages.json>获取:
composer create-project phpmyadmin/phpmyadmin --repository-url=https://www.phpmyadmin.net/packages.json --no-dev
用Docker安装¶
phpMyAdmin 附带了一个可供轻松部署的 Docker 官方镜像 ,您可以使用以下方式下载它:
docker pull phpmyadmin
phpMyAdmin 服务器将监听端口 80。它支持几种配置数据库服务器链接的方法,可以通过 Docker 的链接功能将数据库容器链接到 phpMyAdmin 的 db
(通过指定 --link your_db_host:db
参数)或环境变量(在这种情况下,由您决定在 Docker 中设置网络以允许 phpMyAdmin 容器通过网络访问数据库容器)。
Docker环境变量¶
您可以使用环境变量配置多个phpMyAdmin功能:
-
PMA_ARBITRARY
¶ 允许您在登录表单上输入数据库服务器主机名。
-
PMA_HOST
¶ 要使用的数据库服务器的主机名或IP地址。
-
PMA_VERBOSE
¶ 数据库服务器的详细名称。
-
PMA_VERBOSES
¶ 逗号分隔的数据库服务器的详细名称。
注解
仅在
PMA_VERBOSE
为空的时候使用。
-
PMA_USER
¶ 用于 Config 认证方式 的用户名。
-
PMA_PASSWORD
¶ 用于 Config 认证方式 的密码。
-
PMA_PORT
¶ 要使用的数据库服务器的端口。
-
PMA_SOCKET
¶ Socket file for the database connection.
-
PMA_SOCKETS
¶ Comma-separated list of socket files for the database connections.
注解
Used only if
PMA_SOCKET
is empty.
-
PMA_ABSOLUTE_URI
¶ 完全可信的路径(
https://pma.example.net/
),其中的反向代理使phpMyAdmin可用。
-
PMA_QUERYHISTORYDB
¶ 当设置为 true 时,启用将 SQL 历史存储至
$cfg['Servers'][$i]['pmadb']
中。如果为 false ,历史会存储在浏览器中,当登出系统时会清除。
-
PMA_QUERYHISTORYMAX
¶ 当设置为整数值时,控制历史条目的数量的显示。
-
PMA_CONTROLHOST
¶ When set, this points to an alternate database host used for storing the “phpMyAdmin配置存储” database.
-
PMA_CONTROLUSER
¶ Defines the username for phpMyAdmin to use for the “phpMyAdmin配置存储” database.
-
PMA_CONTROLPASS
¶ Defines the password for phpMyAdmin to use for the “phpMyAdmin配置存储” database.
-
PMA_CONTROLPORT
¶ 如果设置了此选项,会覆盖连接至控制主机的默认端口( 3306 )。
-
PMA_PMADB
¶ When set, define the name of the database to be used for the “phpMyAdmin配置存储” database. When not set, the advanced features are not enabled by default: they can still potentially be enabled by the user when logging in with the 零配置 feature.
注解
Suggested values: phpmyadmin or pmadb
-
HIDE_PHP_VERSION
¶ 如果定义了本选项,会隐藏 PHP 版本(expose_php = Off ),设置为任何值(例如 HIDE_PHP_VERSION=true )。
-
UPLOAD_LIMIT
¶ If set, this option will override the default value for apache and php-fpm (this will change
upload_max_filesize
andpost_max_size
values).注解
Format as [0-9+](K,M,G) default value is 2048K
-
MEMORY_LIMIT
¶ If set, this option will override the phpMyAdmin memory limit
$cfg['MemoryLimit']
and PHP’s memory_limit.注解
Format as [0-9+](K,M,G) where K is for Kilobytes, M for Megabytes, G for Gigabytes and 1K = 1024 bytes. Default value is 512M.
-
MAX_EXECUTION_TIME
¶ If set, this option will override the maximum execution time in seconds for phpMyAdmin
$cfg['ExecTimeLimit']
and PHP’s max_execution_time.注解
Format as [0-9+]. Default value is 600.
-
PMA_CONFIG_BASE64
¶ If set, this option will override the default config.inc.php with the base64 decoded contents of the variable.
-
PMA_USER_CONFIG_BASE64
¶ If set, this option will override the default config.user.inc.php with the base64 decoded contents of the variable.
-
PMA_UPLOADDIR
¶ If set, this option will set the path where files can be saved to be available to import (
$cfg['UploadDir']
)
-
PMA_SAVEDIR
¶ If set, this option will set the path where exported files can be saved (
$cfg['SaveDir']
)
-
APACHE_PORT
¶ If set, this option will change the default Apache port from 80 in case you want it to run on a different port like an unprivileged port. Set to any port value (such as APACHE_PORT=8090).
默认情况下,使用 Cookie 认证方式,但如果 PMA_USER
和 PMA_PASSWORD
已设置,则切换到 Config 认证方式 。
自定义配置¶
Additionally configuration can be tweaked by /etc/phpmyadmin/config.user.inc.php
. If
this file exists, it will be loaded after configuration is generated from above
environment variables, so you can override any configuration variable. This
configuration can be added as a volume when invoking docker using
-v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php parameters.
Note that the supplied configuration file is applied after Docker环境变量, but you can override any of the values.
For example to change the default behavior of CSV export you can use the following configuration file:
<?php
$cfg['Export']['csv_columns'] = true;
You can also use it to define server configuration instead of using the environment variables listed in Docker环境变量:
<?php
/* Override Servers array */
$cfg['Servers'] = [
1 => [
'auth_type' => 'cookie',
'host' => 'mydb1',
'port' => 3306,
'verbose' => 'Verbose name 1',
],
2 => [
'auth_type' => 'cookie',
'host' => 'mydb2',
'port' => 3306,
'verbose' => 'Verbose name 2',
],
];
参见
有关配置选项的详细说明,请参阅 设置。
Docker 容器¶
You can use the following volumes to customize image behavior:
/etc/phpmyadmin/config.user.inc.php
Can be used for additional settings, see the previous chapter for more details.
/sessions/
Directory where PHP sessions are stored. You might want to share this for example when using Signon 认证方式.
/www/themes/
Directory where phpMyAdmin looks for themes. By default only those shipped with phpMyAdmin are included, but you can include additional phpMyAdmin themes (see 自定义主题) by using Docker volumes.
Docker 例子¶
要将 phpMyAdmin 连接到给定服务器,请使用:
docker run --name phpmyadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin:latest
要将 phpMyAdmin 连接到更多服务器,请使用:
docker run --name phpmyadmin -d -e PMA_HOSTS=dbhost1,dbhost2,dbhost3 -p 8080:80 phpmyadmin:latest
要使用任意服务器选项:
docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -e PMA_ARBITRARY=1 phpmyadmin:latest
你也可以使用 Docker 连接至数据库容器:
docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 phpmyadmin:latest
使用额外配置文件运行:
docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php phpmyadmin:latest
使用附加主题文件运行:
docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -v /some/local/directory/custom/phpmyadmin/themeName/:/var/www/html/themes/themeName/ phpmyadmin:latest
使用 docker-compose¶
Alternatively, you can also use docker-compose with the docker-compose.yml from <https://github.com/phpmyadmin/docker>. This will run phpMyAdmin with an arbitrary server - allowing you to specify MySQL/MariaDB server on the login page.
docker compose up -d
使用docker compose自定义配置文件¶
你可以使用外部文件来自定义 phpMyAdmin 配置,并通过 volumes 指令传递它:
phpmyadmin:
image: phpmyadmin:latest
container_name: phpmyadmin
environment:
- PMA_ARBITRARY=1
restart: always
ports:
- 8080:80
volumes:
- /sessions
- ~/docker/phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
- /custom/phpmyadmin/theme/:/www/themes/theme/
参见
Running behind haproxy in a subdirectory¶
When you want to expose phpMyAdmin running in a Docker container in a subdirectory, you need to rewrite the request path in the server proxying the requests.
使用 haproxy 可以这样做:
frontend http
bind *:80
option forwardfor
option http-server-close
### NETWORK restriction
acl LOCALNET src 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12
# /phpmyadmin
acl phpmyadmin path_dir /phpmyadmin
use_backend phpmyadmin if phpmyadmin LOCALNET
backend phpmyadmin
mode http
reqirep ^(GET|POST|HEAD)\ /phpmyadmin/(.*) \1\ /\2
# phpMyAdmin container IP
server localhost 172.30.21.21:80
When using traefik, something like following should work:
defaultEntryPoints = ["http"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
regex = "(http:\\/\\/[^\\/]+\\/([^\\?\\.]+)[^\\/])$"
replacement = "$1/"
[backends]
[backends.myadmin]
[backends.myadmin.servers.myadmin]
url="http://internal.address.to.pma"
[frontends]
[frontends.myadmin]
backend = "myadmin"
passHostHeader = true
[frontends.myadmin.routes.default]
rule="PathPrefixStrip:/phpmyadmin/;AddPrefix:/"
You then should specify PMA_ABSOLUTE_URI
in the docker-compose
configuration:
version: '2'
services:
phpmyadmin:
restart: always
image: phpmyadmin:latest
container_name: phpmyadmin
hostname: phpmyadmin
domainname: example.com
ports:
- 8000:80
environment:
- PMA_HOSTS=172.26.36.7,172.26.36.8,172.26.36.9,172.26.36.10
- PMA_VERBOSES=production-db1,production-db2,dev-db1,dev-db2
- PMA_USER=root
- PMA_PASSWORD=
- PMA_ABSOLUTE_URI=http://example.com/phpmyadmin/
快速安装¶
- Choose an appropriate distribution kit from the phpmyadmin.net
Downloads page. Some kits contain only the English messages, others
contain all languages. We’ll assume you chose a kit whose name
looks like
phpMyAdmin-x.x.x-all-languages.tar.gz
. - 确保您下载了真实的存档文件,请参阅 验证 phpMyAdmin 发行版 。
- 解开这个压缩包(包括子目录):在您网站服务器的文档根目录中执行
tar -xzvf phpMyAdmin_x.x.x-all-languages.tar.gz
。如果您不能直接访问服务器,请先把这些文件解压到您自己的电脑上,等完成第 4 步之后,再通过 FTP 等方式将文件上传到您的网站服务器。 - 确保所有的脚本都有正确的所有者(若 PHP 运行于安全模式,脚本间所有者的不同将会导致问题)。参见 4.2 What’s the preferred way of making phpMyAdmin secure against evil access? 和 1.26 我刚刚在IIS的文档根目录中安装了phpMyAdmin,但在尝试运行phpMyAdmin时出现错误“未指定输入文件”。。
- 现在开始设置您的安装。两种方法。以前,用户只能手动编辑一份
config.inc.php
文件,但现在我们为那些喜欢使用图形界面安装的用户提供了一个向导式的安装脚本。手动创建config.inc.php
仍然是一个快速安装的方法且一些高级功能也需要手动编辑该文件。
手动创建文件¶
To manually create the file, simply use your text editor to create the
file config.inc.php
(you can copy config.sample.inc.php
to get
a minimal configuration file) in the main (top-level) phpMyAdmin
directory (the one that contains index.php
). phpMyAdmin first
loads the default configuration values and then overrides those values
with anything found in config.inc.php
. If the default value is
okay for a particular setting, there is no need to include it in
config.inc.php
. You’ll probably need only a few directives to get going; a
simple configuration may look like this:
<?php
// The string is a hexadecimal representation of a 32-bytes long string of random bytes.
$cfg['blowfish_secret'] = sodium_hex2bin('f16ce59f45714194371b48fe362072dc3b019da7861558cd4ad29e4d6fb13851');
$i=0;
$i++;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
// if you insist on "root" having no password:
// $cfg['Servers'][$i]['AllowNoPassword'] = true;
或者,若您不想每次都登录:
<?php
$i=0;
$i++;
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'changeme'; // use here your password
$cfg['Servers'][$i]['auth_type'] = 'config';
警告
在配置文件中存储密码非常不安全,因为任何人都可以修改您的数据库。
所有设置的完整说明请参见本文档的 设置 一节。
使用安装脚本¶
不想手动编辑 config.inc.php 的话,您可以使用phpMyAdmin的设置功能。该文件可以使用安装程序生成,您可以下载该文件以上传到服务器。
接下来,打开你的浏览器,访问你安装 phpMyAdmin 的位置,后缀为 /setup
。这些变化不会被保存到服务器上,你需要使用 :guilabel:`Download`按钮把它们保存到你的电脑上,然后再上传到服务器上。
现在文件保存好了。您可以使用您最喜欢的编辑器来复查或编辑一些安装脚本中没有提供的高级选项。
- 若您使用“config”
auth_type
,您应保护好 phpMyAdmin 的安装文件夹,因为 config 认证不要求用户输入密码即可访问 phpMyAdmin。我们建议使用其它认证方式,如在 .htaccess 文件中设置 HTTP 认证或修改auth_type
为 cookie 或 http。参见 ISP 与多用户安装,特别要注意 4.4 使用 HTTP 认证时,phpMyAdmin 总会报错 “拒绝访问”。。 - 在您的浏览器中打开 phpMyAdmin 主目录。现在 phpMyAdmin 应该显示一个欢迎页面和您的数据库,若使用 HTTP 或 cookie 认证方式则应显示一个登录对话框。
Debian、Ubuntu及其衍生产品的安装脚本¶
Debian 和 Ubuntu 改变了启用和禁用安装脚本的方法,对于每个动作有一个单独的执行命令。
要允许修改设置,请执行:
/usr/sbin/pma-configure
要拒绝修改设置,请执行:
/usr/sbin/pma-secure
openSUSE 使用的安装脚本¶
Some openSUSE releases do not include setup script in the package. In case you want to generate configuration on these you can either download original package from <https://www.phpmyadmin.net/> or use setup script on our demo server: <https://demo.phpmyadmin.net/master/setup/>.
验证 phpMyAdmin 发行版¶
Since July 2015 all phpMyAdmin releases are cryptographically signed by the releasing developer, who through January 2016 was Marc Delisle. His key id is 0xFEFC65D181AF644A, his PGP fingerprint is:
436F F188 4B1A 0C3F DCBF 0D79 FEFC 65D1 81AF 644A
and you can get more identification information from <https://keybase.io/lem9>.
Beginning in January 2016, the release manager is Isaac Bennetch. His key id is 0xCE752F178259BD92, and his PGP fingerprint is:
3D06 A59E CE73 0EB7 1B51 1C17 CE75 2F17 8259 BD92
and you can get more identification information from <https://keybase.io/ibennetch>.
Some additional downloads (for example themes) might be signed by Michal Čihař. His key id is 0x9C27B31342B7511D, and his PGP fingerprint is:
63CB 1DF1 EF12 CF2A C0EE 5A32 9C27 B313 42B7 511D
and you can get more identification information from <https://keybase.io/nijel>.
You should verify that the signature matches the archive you have downloaded. This way you can be sure that you are using the same code that was released. You should also verify the date of the signature to make sure that you downloaded the latest version.
Each archive is accompanied by .asc
files which contain the PGP signature
for it. Once you have both of them in the same folder, you can verify the signature:
$ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
gpg: Can't check signature: public key not found
As you can see gpg complains that it does not know the public key. At this point, you should do one of the following steps:
- Download the keyring from our download server, then import it with:
$ gpg --import phpmyadmin.keyring
- Download and import the key from one of the key servers:
$ gpg --keyserver hkp://pgp.mit.edu --recv-keys 3D06A59ECE730EB71B511C17CE752F178259BD92
gpg: requesting key 8259BD92 from hkp server pgp.mit.edu
gpg: key 8259BD92: public key "Isaac Bennetch <bennetch@gmail.com>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
This will improve the situation a bit - at this point, you can verify that the signature from the given key is correct but you still can not trust the name used in the key:
$ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
gpg: Good signature from "Isaac Bennetch <bennetch@gmail.com>"
gpg: aka "Isaac Bennetch <isaac@bennetch.org>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 3D06 A59E CE73 0EB7 1B51 1C17 CE75 2F17 8259 BD92
The problem here is that anybody could issue the key with this name. You need to ensure that the key is actually owned by the mentioned person. The GNU Privacy Handbook covers this topic in the chapter Validating other keys on your public keyring. The most reliable method is to meet the developer in person and exchange key fingerprints, however, you can also rely on the web of trust. This way you can trust the key transitively though signatures of others, who have met the developer in person.
Once the key is trusted, the warning will not occur:
$ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
gpg: Good signature from "Isaac Bennetch <bennetch@gmail.com>" [full]
Should the signature be invalid (the archive has been changed), you would get a clear error regardless of the fact that the key is trusted or not:
$ gpg --verify phpMyAdmin-4.5.4.1-all-languages.zip.asc
gpg: Signature made Fri 29 Jan 2016 08:59:37 AM EST using RSA key ID 8259BD92
gpg: BAD signature from "Isaac Bennetch <bennetch@gmail.com>" [unknown]
phpMyAdmin配置存储¶
在 3.4.0 版更改: Prior to phpMyAdmin 3.4.0 this was called Linked Tables Infrastructure, but the name was changed due to the extended scope of the storage.
若要使用一些额外功能( 书签 、注释、 SQL 历史、结构追踪、PDF 生成、 转换 、 关系 等),您需要创建一系列特殊的表。 这些表可以放在您自己的数据库里,也可以在一个多用户的服务器上创建一个独立的中心数据库(该数据库将通过其对应的帐号访问,所以不应给其他用户访问该数据库的权限)。
零配置¶
In many cases, this database structure can be automatically created and
configured. This is called “Zero Configuration” mode and can be particularly
useful in shared hosting situations. “ZeroConf” mode is on by default, to
disable set $cfg['ZeroConf']
to false.
The following three scenarios are covered by the Zero Configuration mode:
- When entering a database where the configuration storage tables are not present, phpMyAdmin offers to create them from the Operations tab.
- When entering a database where the tables do already exist, the software
automatically detects this and begins using them. This is the most common
situation; after the tables are initially created automatically they are
continually used without disturbing the user; this is also most useful on
shared hosting where the user is not able to edit
config.inc.php
and usually the user only has access to one database. - When having access to multiple databases, if the user first enters the database containing the configuration storage tables then switches to another database, phpMyAdmin continues to use the tables from the first database; the user is not prompted to create more tables in the new database.
手动配置¶
您可以在 ./sql/
文件夹中找到 create_tables.sql 文件。(若您使用 Windows 服务器,请特别注意 1.23 我在 Win32 系统上使用 MySQL,每次我创建表的时候列名都会被自动设为全小写,这是怎么回事?)。
如果已经具有了这种结构并:
- 已经升级 MySQL 到 4.1.2 或更高版本,请执行
examples/upgrade_tables_mysql_4_1_2+.sql
。 - 已经将 phpMyAdmin 2.5.0 或更高版本 (<= 4.2.x),升级至 phpMyAdmin 4.3.0 或者更高的版本,请执行脚本
sql/upgrade_column_info_4_3_0+.sql
。 - 已经将 phpMyAdmin 4.3.0 或较高版本,升级至 phpMyAdmin 4.7.0 或者更高的版本,请执行脚本
sql/upgrade_tables_4_7_0+.sql
。
且通过导入 sql/create_tables.sql
创建了新的表格。
您可以使用 phpMyAdmin 来创建这些表。但请注意您可能需要特殊(管理员)权限来创建数据库和表,而且可能还需要根据数据库名修改脚本。
在导入 sql/create_tables.sql
文件之后,您还需要在 config.inc.php
文件中设置表名。您可以在 设置 一节中找到相应的指令。
你需要拥有一个控制用户( $cfg['Servers'][$i]['controluser']
和 $cfg['Servers'][$i]['controlpass']
设置项),并给予他们对这些表格的合适的权限。例如,你可以用下列语句创建他们:
对于任何 MariaDB 版本来说:
CREATE USER 'pma'@'localhost' IDENTIFIED VIA mysql_native_password USING 'pmapass';
GRANT SELECT, INSERT, UPDATE, DELETE ON `<pma_db>`.* TO 'pma'@'localhost';
对于 MySQL 8.0 或更高版本:
CREATE USER 'pma'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'pmapass';
GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost';
对于低于 8.0 的 MySQL 版本:
CREATE USER 'pma'@'localhost' IDENTIFIED WITH mysql_native_password AS 'pmapass';
GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost';
Note that MySQL installations with PHP older than 7.4 and MySQL newer than 8.0 may require using the mysql_native_password authentication as a workaround, see 1.45 尝试登录时,我收到错误信息“未知的认证方法 caching_sha2_password” for details.
从旧版本升级¶
警告
永远 不要 将新版本 phpMyAdmin 直接覆盖解压于现有的安装上,要总是先移除旧文件,仅仅保留配置。
这样,你就不会在目录中留下任何旧的或过时的文件。这些文件可能会产生严重的安全问题,或可能导致各种故障。
只需复制您原来的 config.inc.php
到新版本即可。当某些选项被改变或取消时,也可能需要做一些修改。为了兼容 PHP 5.3 及更新版本,您需要删除可能出现在您配置文件最后的 set_magic_quotes_runtime(0);
语句。
The complete upgrade can be performed in a few simple steps:
- 你可以在 <http://www.phpmyadmin.net/> 获得 phpMyAdmin 的最新版本。
- Rename existing phpMyAdmin folder (for example to
phpmyadmin-old
). - Unpack freshly downloaded phpMyAdmin to the desired location (for example
phpmyadmin
). - Copy
config.inc.php`
from old location (phpmyadmin-old
) to the new one (phpmyadmin
). - Test that everything works properly.
- Remove backup of a previous version (
phpmyadmin-old
).
若您将 MySQL 服务器从 4.1.2 之前的版本升级到了 5.x 或更高版本,并且您使用 phpMyAdmin 配置信息存储,您还要运行 SQL 脚本 sql/upgrade_tables_mysql_4_1_2+.sql
。
若您将 MySQL 服务器从 2.5.0 版本或更高版本(低于 4.2.x 版本)升级到了 4.3.0,并且您使用 phpMyAdmin 存储配置,您还要运行 SQL 脚本 sql/upgrade_column_info_4_3_0+.sql
。
别忘了退出并重新登录来清除浏览器缓存并清空旧的会话。
认证方式的使用¶
当您在 多用户环境 下想让用户只能访问各自的数据库时我们推荐您使用 HTTP 和 cookie 认证方式。但请注意直到 IE 6 时微软的 IE 浏览器仍然有处理 cookies 的缺陷。您也许在 单用户环境 下仍然会使用 HTTP 或 cookie 认证方式,因为这样您的用户名/密码将不会以明文出现在配置文件中。
HTTP 和 cookie 认证方式更加安全:不需要在 phpMyAdmin 配置文件中设置 MySQL 登录信息(除了 $cfg['Servers'][$i]['controluser']
)。但请注意除非您使用了 HTTPS 协议,否则密码总是以明文传输的。在 cookie 认证方式下,密码将通过 AES 算法加密后保存到一个临时 cookie 中。
每个*真实的*用户应在特定的数据库上拥有一定的权限。除非您很明白这些权限的作用(例如:需要创建一个超级用户),否则您不应轻易授予普通用户任何全局权限。如:授予用户 real_user 具有对数据库 user_base 的所有权限:
GRANT ALL PRIVILEGES ON user_base.* TO 'real_user'@localhost IDENTIFIED BY 'real_password';
现在用户可以做什么已经完全被 MySQL 用户管理系统所控制了。在 HTTP 或 cookie 认证方式下,您不需要填写 $cfg['Servers']
中的 user/password 设置。
参见
1.32 我可以配合 IIS 使用 HTTP 认证吗?, 1.35 我将 PHP 配置为在 Apache 上以 CGI 方式运行。在这种情况下我能否使用 HTTP 认证?, 4.1 我是互联网服务提供商(ISP),我可以在服务中心只安装一遍 phpMyAdmin ,还是需要每个客户都要安装一遍?, 4.2 What’s the preferred way of making phpMyAdmin secure against evil access?, 4.3 I get errors about not being able to include a file in /lang or in /libraries.
HTTP 认证方式¶
通过 HTTP 基本认证方式将允许您使用任何有效的 MySQL 用户登录。
支持大部分 PHP 设置。 IIS ( ISAPI)上的 CGI PHP 支持请参见 1.32 我可以配合 IIS 使用 HTTP 认证吗?,Apache 上的 CGI 支持请参见 1.35 我将 PHP 配置为在 Apache 上以 CGI 方式运行。在这种情况下我能否使用 HTTP 认证?。
When PHP is running under Apache’s mod_proxy_fcgi (e.g. with PHP-FPM),
Authorization
headers are not passed to the underlying FCGI application, such that your credentials will not reach the application. In this case, you can add the following configuration directive:SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
参见 4.4 使用 HTTP 认证时,phpMyAdmin 总会报错 “拒绝访问”。 关于不要同时使用 .htaccess 和‘ HTTP’认证方式。
注解
There is no way to do proper logout in HTTP authentication, most browsers will remember credentials until there is no different successful authentication. Because of this, this method has a limitation that you can not login with the same user after logout.
Cookie 认证方式¶
- 在一次会话中,用户名和密码被存储在 cookies 中,当会话结束时就会删除密码的存储。
- 在该认证方式下,用户可以真正的退出 phpMyAdmin 并用相同的用户再次登录(在 HTTP 认证方式 方式当中是不可行的)。
- 若您想让用户输入任意主机名登录(而不仅限于文件
config.inc.php
中的定义),请参见$cfg['AllowArbitraryServer']
指令。 - 在 需求 一节中我们提到过,可选的
openssl
扩展可以显著提高访问速度,但不是必须的。
Signon 认证方式¶
- This mode is a convenient way of using credentials from another application to authenticate to phpMyAdmin to implement a single signon solution.
- The other application has to store login information into session
data (see
$cfg['Servers'][$i]['SignonSession']
and$cfg['Servers'][$i]['SignonCookieParams']
) or you need to implement script to return the credentials (see$cfg['Servers'][$i]['SignonScript']
). - When no credentials are available, the user is being redirected to
$cfg['Servers'][$i]['SignonURL']
, where you should handle the login process.
The very basic example of saving credentials in a session is available as
examples/signon.php
:
<?php
/**
* Single signon for phpMyAdmin
*
* This is just example how to use session based single signon with
* phpMyAdmin, it is not intended to be perfect code and look, only
* shows how you can integrate this functionality in your application.
*/
declare(strict_types=1);
/* Use cookies for session */
ini_set('session.use_cookies', 'true');
/* Change this to true if using phpMyAdmin over https */
$secureCookie = false;
/* Need to have cookie visible from parent directory */
session_set_cookie_params(0, '/', '', $secureCookie, true);
/* Create signon session */
$sessionName = 'SignonSession';
session_name($sessionName);
// Uncomment and change the following line to match your $cfg['SessionSavePath']
//session_save_path('/foobar');
@session_start();
/* Was data posted? */
if (isset($_POST['user'])) {
/* Store there credentials */
$_SESSION['PMA_single_signon_user'] = $_POST['user'];
$_SESSION['PMA_single_signon_password'] = $_POST['password'];
$_SESSION['PMA_single_signon_host'] = $_POST['host'];
$_SESSION['PMA_single_signon_port'] = $_POST['port'];
/* Update another field of server configuration */
$_SESSION['PMA_single_signon_cfgupdate'] = ['verbose' => 'Signon test'];
$_SESSION['PMA_single_signon_HMAC_secret'] = hash('sha1', uniqid(strval(random_int(0, mt_getrandmax())), true));
$id = session_id();
/* Close that session */
@session_write_close();
/* Redirect to phpMyAdmin (should use absolute URL here!) */
header('Location: ../index.php');
} else {
/* Show simple form */
header('Content-Type: text/html; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
echo '<!DOCTYPE HTML>
<html lang="en" dir="ltr">
<head>
<link rel="icon" href="../favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
<meta charset="utf-8">
<title>phpMyAdmin single signon example</title>
</head>
<body>';
if (isset($_SESSION['PMA_single_signon_error_message'])) {
echo '<p class="error">';
echo $_SESSION['PMA_single_signon_error_message'];
echo '</p>';
}
echo '<form action="signon.php" method="post">
Username: <input type="text" name="user" autocomplete="username" spellcheck="false"><br>
Password: <input type="password" name="password" autocomplete="current-password" spellcheck="false"><br>
Host: (will use the one from config.inc.php by default)
<input type="text" name="host"><br>
Port: (will use the one from config.inc.php by default)
<input type="text" name="port"><br>
<input type="submit">
</form>
</body>
</html>';
}
Alternatively, you can also use this way to integrate with OpenID as shown
in examples/openid.php
:
<?php
/**
* Single signon for phpMyAdmin using OpenID
*
* This is just example how to use single signon with phpMyAdmin, it is
* not intended to be perfect code and look, only shows how you can
* integrate this functionality in your application.
*
* It uses OpenID pear package, see https://pear.php.net/package/OpenID
*
* User first authenticates using OpenID and based on content of $AUTH_MAP
* the login information is passed to phpMyAdmin in session data.
*/
declare(strict_types=1);
if (false === @include_once 'OpenID/RelyingParty.php') {
exit;
}
/* Change this to true if using phpMyAdmin over https */
$secureCookie = false;
/**
* Map of authenticated users to MySQL user/password pairs.
*/
$authMap = ['https://launchpad.net/~username' => ['user' => 'root', 'password' => '']];
// phpcs:disable PSR1.Files.SideEffects,Squiz.Functions.GlobalFunction
/**
* Simple function to show HTML page with given content.
*
* @param string $contents Content to include in page
*/
function Show_page(string $contents): void
{
header('Content-Type: text/html; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
echo '<!DOCTYPE HTML>
<html lang="en" dir="ltr">
<head>
<link rel="icon" href="../favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
<meta charset="utf-8">
<title>phpMyAdmin OpenID signon example</title>
</head>
<body>';
if (isset($_SESSION['PMA_single_signon_error_message'])) {
echo '<p class="error">' . $_SESSION['PMA_single_signon_message'] . '</p>';
unset($_SESSION['PMA_single_signon_message']);
}
echo $contents;
echo '</body></html>';
}
/**
* Display error and exit
*
* @param Exception $e Exception object
*/
function Die_error(Throwable $e): void
{
$contents = "<div class='relyingparty_results'>\n";
$contents .= '<pre>' . htmlspecialchars($e->getMessage()) . "</pre>\n";
$contents .= "</div class='relyingparty_results'>";
Show_page($contents);
exit;
}
// phpcs:enable
/* Need to have cookie visible from parent directory */
session_set_cookie_params(0, '/', '', $secureCookie, true);
/* Create signon session */
$sessionName = 'SignonSession';
session_name($sessionName);
@session_start();
// Determine realm and return_to
$base = 'http';
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') {
$base .= 's';
}
$base .= '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'];
$realm = $base . '/';
$returnTo = $base . dirname($_SERVER['PHP_SELF']);
if ($returnTo[strlen($returnTo) - 1] !== '/') {
$returnTo .= '/';
}
$returnTo .= 'openid.php';
/* Display form */
if ((! count($_GET) && ! count($_POST)) || isset($_GET['phpMyAdmin'])) {
/* Show simple form */
$content = '<form action="openid.php" method="post">
OpenID: <input type="text" name="identifier"><br>
<input type="submit" name="start">
</form>';
Show_page($content);
exit;
}
/* Grab identifier */
$identifier = null;
if (isset($_POST['identifier']) && is_string($_POST['identifier'])) {
$identifier = $_POST['identifier'];
} elseif (isset($_SESSION['identifier']) && is_string($_SESSION['identifier'])) {
$identifier = $_SESSION['identifier'];
}
/* Create OpenID object */
try {
$o = new OpenID_RelyingParty($returnTo, $realm, $identifier);
} catch (Throwable $e) {
Die_error($e);
}
/* Redirect to OpenID provider */
if (isset($_POST['start'])) {
try {
$authRequest = $o->prepare();
} catch (Throwable $e) {
Die_error($e);
}
$url = $authRequest->getAuthorizeURL();
header('Location: ' . $url);
exit;
}
/* Grab query string */
if (! count($_POST)) {
[, $queryString] = explode('?', $_SERVER['REQUEST_URI']);
} else {
// Fetch the raw query body
$queryString = file_get_contents('php://input');
}
/* Check reply */
try {
$message = new OpenID_Message($queryString, OpenID_Message::FORMAT_HTTP);
} catch (Throwable $e) {
Die_error($e);
}
$id = $message->get('openid.claimed_id');
if (empty($id) || ! isset($authMap[$id])) {
Show_page('<p>User not allowed!</p>');
exit;
}
$_SESSION['PMA_single_signon_user'] = $authMap[$id]['user'];
$_SESSION['PMA_single_signon_password'] = $authMap[$id]['password'];
$_SESSION['PMA_single_signon_HMAC_secret'] = hash('sha1', uniqid(strval(random_int(0, mt_getrandmax())), true));
session_write_close();
/* Redirect to phpMyAdmin (should use absolute URL here!) */
header('Location: ../index.php');
If you intend to pass the credentials using some other means than, you have to
implement wrapper in PHP to get that data and set it to
$cfg['Servers'][$i]['SignonScript']
. There is a very minimal example
in examples/signon-script.php
:
<?php
/**
* Single signon for phpMyAdmin
*
* This is just example how to use script based single signon with
* phpMyAdmin, it is not intended to be perfect code and look, only
* shows how you can integrate this functionality in your application.
*/
declare(strict_types=1);
// phpcs:disable Squiz.Functions.GlobalFunction
/**
* This function returns username and password.
*
* It can optionally use configured username as parameter.
*
* @param string $user User name
*
* @return array<int,string>
*/
function get_login_credentials(string $user): array
{
/* Optionally we can use passed username */
if (! empty($user)) {
return [$user, 'password'];
}
/* Here we would retrieve the credentials */
return ['root', ''];
}
Config 认证方式¶
- 该认证方式是最不安全的,因为它需要在配置文件中设置好
$cfg['Servers'][$i]['user']
和$cfg['Servers'][$i]['password']
(这将导致任何可以读取config.inc.php
文件的人都能知道您的用户名和密码)。 - 在 ISP 与多用户安装 一节中将会说明如何保护您的配置文件。
- 为了让该认证方式更加安全,您还可以考虑使用主机认证的
$cfg['Servers'][$i]['AllowDeny']['order']
和$cfg['Servers'][$i]['AllowDeny']['rules']
指令。 - 与 cookie 和 http 不同,在访问 phpMyAdmin 时 config 认证方式不会要求用户登录。虽然设计如此但这将导致任意用户都能访问。我们建议使用某些方式进行限制,如一个含有要求 HTTP 认证指令的 .htaccess 文件或者从路由器或防火墙设置禁止特定的 HTTP 访问(上述方法均不属于本文档的范围,但可以很容易地通过 Google 搜索到)。
加固您的 phpMyAdmin 安装¶
phpMyAdmin 团队致力于应用软件的安全性,而且总会有让您的安装变得更加安全的方法:
遵循我们的 安全公告 <https://www.phpmyadmin.net/security/> _ 并在每次有漏洞发布时都将 phpMyAdmin 更新。
仅使用 HTTPS 提供 phpMyAdmin 服务,最好一并使用 HSTS 机制,这样可以防御协议降级攻击。
确保 PHP 安装遵循了生产环境站点的推荐配置,如应该禁用 display_errors 。
除非你正在开发并需要测试套件,否则从phpMyAdmin中删除
test
目录。从phpMyAdmin中删除
setup
目录,初始设置后你可能不会使用它。正确选择认证方式 - Cookie 认证方式 是共享主机的最好选择。
您应在您的网站服务器设置中禁止对
./libraries
和./setup/lib
这两个子文件夹的访问。在 Apache 中您可以通过 .htaccess 文件设置,其它网站服务器请自行设置。通过该设置可预防路径泄露和跨站脚本攻击。禁止访问临时文件,参见
$cfg['TempDir']
,如果它位于你的 web root,参见 Web 服务器上传/保存/导入目录 。您还可以禁止搜索引擎访问公开的 phpMyAdmin,因为这对它们没有任何用处。您可以使用网站服务器根文件夹的
robots.txt
文件或直接从网站服务器设置中限制其访问,参见 1.42 如何阻止爬虫机器人访问 phpMyAdmin?。如果您不希望所有 MySQL 用户都能访问 phpMyAdmin,可以使用
$cfg['Servers'][$i]['AllowDeny']['rules']
来限制它们,或者使用cfg['Servers'][$i]['AllowRoot']
来拒绝 root 用户访问。为您的账户启用 双因素身份验证。
考虑将 phpMyAdmin 隐藏在认证代理后面,这样用户在向 phpMyAdmin 提供 MySQL 凭证之前就需要进行认证。你可以通过配置你的 Web 服务器以请求 HTTP 认证来实现这一点。例如,在 Apache 中可以这样做:
AuthType Basic AuthName "Restricted Access" AuthUserFile /usr/share/phpmyadmin/passwd Require valid-user
一旦改变了配置,你需要创建一系列可供认证的用户。这可以通过 htpasswd 功能做到:
htpasswd -c /usr/share/phpmyadmin/passwd username
若您担心自动化的攻击,通过
$cfg['CaptchaLoginPublicKey']
和$cfg['CaptchaLoginPrivateKey']
启用验证码会有一定作用。Failed login attempts are logged to syslog (if available, see
$cfg['AuthLog']
). This can allow using a tool such as fail2ban to block brute-force attempts. Note that the log file used by syslog is not the same as the Apache error or access log files.In case you’re running phpMyAdmin together with other PHP applications, it is generally advised to use separate session storage for phpMyAdmin to avoid possible session-based attacks against it. You can use
$cfg['SessionSavePath']
to achieve this.
使用SSL连接到数据库服务器¶
推荐使用 SSL 连接至远程数据库服务器,这里有一些与 SSL 配置相关的选项:
$cfg['Servers'][$i]['ssl']`
- 决定是否使用 SSL。如果你只启用了这个,会加密连接,但不会经过认证——你无法知道是否与正确的服务器进行了通信。
$cfg['Servers'][$i]['ssl_key']
和$cfg['Servers'][$i]['ssl_cert']
- 用于客户端对服务器的认证。
$cfg['Servers'][$i]['ssl_ca']
和$cfg['Servers'][$i]['ssl_ca_path']
- 你信任的服务器证书机构。这是用来确保你正在与一个受信任的服务器对话。
$cfg['Servers'][$i]['ssl_verify']`
- 此配置项禁用了服务器证书认证,请小心使用。
当数据库服务器使用本地连接或私人网络,并且不能配置 SSL 时,您可以使用 $cfg['MysqlSslWarningSafeHosts']
来明确列出安全的主机名。
已知问题¶
具有特定列权限的用户无法进行“浏览”操作¶
如果一个用户对一个表中的某些(而不是所有)列只有特定的权限,“浏览”会出错。
As a workaround, a bookmarked query with the same name as the table can be created, this will run when using the “Browse” link instead. Issue 11922.
使用 ‘http’ 认证注销后重新登录的问题¶
When using the ‘http’ auth_type
, it can be impossible to log back in (when the logout comes
manually or after a period of inactivity). Issue 11898.
设置¶
所有可配置的数据均位于 phpMyAdmin 的根目录下的 config.inc.php
文件中。若该文件不存在,请参考 安装 一节来创建它。该文件只需包含你想从其相应的默认值中改变的参数。
参见
示例 为示例配置
如果文件中缺少指令,则只需在文件中添加另一行。该文件用于覆盖默认值;如果您想使用默认值,则无需在此处添加行。
与设计相关的设置(如颜色)是通过 themes/主题名/scss/_variables.scss
定义的。你可以创建 config.footer.inc.php
和 config.header.inc.php
文件分别向你的网站的每个页面的页眉和页脚添加特定代码。
注解
有些版本(如:Debian 或 Ubuntu)将 config.inc.php
放在 /etc/phpmyadmin
中而不是 phpMyAdmin 源代码中。
基本设置¶
-
$cfg['PmaAbsoluteUri']
¶ 类型: 文本 默认值: ''
在 4.6.5 版更改: phpMyAdmin 4.6.0 - 4.6.4中没有此设置。
设置您 phpMyAdmin 安装文件夹的完整 URL (包含路径)。如:
https://www.example.net/path_to_your_phpMyAdmin_directory/
。请注意大多数网站服务器的 URL 是区分大小写的(甚至在Windows上)。别忘了最后的斜杠。自 2.3.0 起,我们建议尝试将该设置留空。大多数情况下 phpMyAdmin 能正确地自动识别。端口转发或复杂反向代理设置的用户可能需要设置此项。
通过浏览一张表、编辑并保存一条记录可以测试出自动识别是否有问题。若有问题 phpMyAdmin 会提示出错。若您收到了必须设置或自动识别失败的错误,请在我们的缺陷追踪器上向我们提交一份缺陷报告以便我们能改进相关代码。
-
$cfg['PmaNoRelation_DisableWarning']
¶ 类型: 布尔值 默认值: false 自 2.3.0 起 phpMyAdmin 提供了一系列关于主/外表的功能 (参见
$cfg['Servers'][$i]['pmadb']
)。如果你尝试使用这些功能但无法正常使用,请在你想使用该功能的数据库中打开:guilabel:结构 页。你会看到一个可以告诉你为什么这些功能无法使用的链接。
若您不想使用那些功能,将该项设为
true
即可隐藏提示信息。
-
$cfg['AuthLog']
¶ 类型: 文本 默认值: 'auto'
4.8.0 新版功能: 自phpMyAdmin 4.8.0起支持此功能。
配置认证记录目的地。失败(或全部,取决于
$cfg['AuthLogSuccess']
)认证尝试将记录在这个目录下面:auto
- 让phpMyAdmin自动选择``syslog``和``php``。
syslog
- 使用syslog及AUTH工具进行日志记录,在大多数系统上最后会输出到
/var/log/auth.log
。 php
- 记录到PHP错误日志。
sapi
- 记录到PHP SAPI日志记录。
/path/to/file
- 任何其他值都被视为文件名,并在那里写入日志条目。
注解
记录到文件时,请确保为Web服务器用户正确设置其权限,设置应严格匹配如下描述的说明:
$cfg['TempDir']
:
-
$cfg['AuthLogSuccess']
¶ 类型: 布尔值 默认值: false 4.8.0 新版功能: 自phpMyAdmin 4.8.0起支持此功能。
是否将成功的身份验证尝试记录到
$cfg['AuthLog']
。
-
$cfg['SuhosinDisableWarning']
¶ 类型: 布尔值 默认值: false 若检测到 Suhosin 将在首页中显示警告。
将该项设为
true
即可隐藏提示信息。
-
$cfg['LoginCookieValidityDisableWarning']
¶ 类型: 布尔值 默认值: false 如果PHP参数session.gc_maxlifetime低于phpMyAdmin中配置的cookie有效性,则主页上会显示警告。
将该项设为
true
即可隐藏提示信息。
-
$cfg['ServerLibraryDifference_DisableWarning']
¶ 类型: 布尔值 默认值: false 4.7.0 版后已移除: 此设置已删除,因为警告也已删除。
若服务器与 MySQL 库版本不同将在首页中显示警告。
将该项设为
true
即可隐藏提示信息。
-
$cfg['ReservedWordDisableWarning']
¶ 类型: 布尔值 默认值: false 若表的一个或多个字段名为 MySQL 保留字时将在该表的结构页中显示警告。
将该项设为
true
即可关闭该警告。
-
$cfg['TranslationWarningThreshold']
¶ 类型: 整数 默认值: 80 显示翻译不完整警告的阈值。
-
$cfg['SendErrorReports']
¶ 类型: 文本 默认值: 'ask'
有效值有:
ask
always
- 从不
设置JavaScript错误报告的默认行为。
每当在JavaScript执行中检测到错误时,如果用户同意,可以向phpMyAdmin团队发送错误报告。
每次出现新的错误报告时,默认设置
'ask'
都会询问用户。但是你可以将这个参数设置为'always'
来发送错误报告而不要求确认,或者你可以将它设置为'never'
永不发送错误报告。该指令在配置文件和用户首选项中均可用。如果负责多用户安装的人员更喜欢为所有用户禁用此功能,则应设置值为
'never'
,并且$cfg['UserprefsDisallow']
指令应该在其中一个数组值中包含``’SendErrorReports’`` 。
-
$cfg['ConsoleEnterExecutes']
¶ 类型: 布尔值 默认值: false 将其设置为``true``允许用户通过按Enter而不是Ctrl + Enter来执行查询。按Shift + Enter可以插入新行。
可以使用控制台的设置界面临时更改控制台的行为。
-
$cfg['AllowThirdPartyFraming']
¶ 类型: 布尔值|文本 默认值: false 将该项设为
true
将允许 phpMyAdmin 被嵌入到框架中,同时是一个潜在的安全隐患并将导致跨框架脚本攻击或点击劫持成为可能。将此设置为’sameorigin’可防止phpMyAdmin包含在框架中的其他文档中,除非该文档属于同一域名。
服务器连接设置¶
-
$cfg['Servers']
¶ 类型: 数组 默认值: 一个服务器数组,下面列出了设置 自 1.4.2 起,phpMyAdmin 支持管理多个 MySQL 服务器。因此使用了
$cfg['Servers']
数组来保存不同服务器的登录信息。第一个$cfg['Servers'][$i]['host']
表示第一个服务器的主机名,第二个$cfg['Servers'][$i]['host']
表示第二个服务器的主机名,以此类推。在libraries/config.default.php
中,只有一节服务器的设置,您可以根据需要将其多次复制到config.inc.php
中,完全复制或仅复制需要的部分(您要修改的部分)都行。注解
$cfg['Servers']
数组由 $cfg[‘Servers’][1] 开始。请勿使用 $cfg[‘Servers’][0]。若您需要多个服务器,请复制(包含自增的 $i)多次。您不需要设置所有服务器数组,设置您要修改的值即可。
-
$cfg['Servers'][$i]['host']
¶ 类型: 文本 默认值: 'localhost'
您第 $i 个 MySQL 服务器的主机名或 IP 地址。如
localhost
。有效值有:
- 主机名,如:
'localhost'
或'mydb.example.org'
- IP 地址,如:
'127.0.0.1'
或'192.168.10.1'
- IPv6 地址, 如
2001:cdba:0000:0000:0000:0000:3257:9652
- 点 -
'.'
,即 Windows 系统上的命名管道 - 空 -
''
,禁用该服务器
注解
主机名``localhost``由MySQL专门处理,它使用基于套接字的连接协议。要使用TCP/IP网络,请使用IP地址或主机名,例如``127.0.0.1``或``db.example.com``。您可以使用
$cfg['Servers'][$i]['socket']
配置套接字的路径。- 主机名,如:
-
$cfg['Servers'][$i]['port']
¶ 类型: 文本 默认值: ''
您第 $i 个 MySQL 服务器的端口号。默认(留空)为 3306。
注解
若您使用
localhost
作为主机名,MySQL 将忽略端口号而使用套接字进行连接,所以若您想连接到非默认端口,请在$cfg['Servers'][$i]['host']
中填写127.0.0.1
或真正的主机名。
-
$cfg['Servers'][$i]['socket']
¶ 类型: 文本 默认值: ''
要使用的套接字路径。留空为默认。要确定正确的套接字,请查看您的 MySQL 设置,或使用 MySQL 命令行客户端执行
status
命令。该命令将会显示出所使用的套接字。注解
它仅当
$cfg['Servers'][$i]['host']
设置为localhost
的时候会生效。
-
$cfg['Servers'][$i]['ssl']
¶ 类型: 布尔值 默认值: false 是否为phpMyAdmin和MySQL服务器之间的连接启用SSL以保护连接。
当使用``’mysql’
扩展名时,其余的
’ssl…’`` 配置选项都不适用。我们强烈建议您在使用该项的同时使用``’mysqli’`` 扩展。
-
$cfg['Servers'][$i]['ssl_key']
¶ 类型: 文本 默认值: 空 通过 SSL 连接到 MySQL 服务器时所用的客户端密钥文件路径。这用于向服务器验证客户端。
如:
$cfg['Servers'][$i]['ssl_key'] = '/etc/mysql/server-key.pem';
-
$cfg['Servers'][$i]['ssl_cert']
¶ 类型: 文本 默认值: 空 通过 SSL 连接到 MySQL 服务器时所用的客户端证书文件路径。这用于向服务器验证客户端。
-
$cfg['Servers'][$i]['ssl_ca']
¶ 类型: 文本 默认值: 空 通过 SSL 连接到 MySQL 服务器时所用的证书颁发机构文件路径。
-
$cfg['Servers'][$i]['ssl_ca_path']
¶ 类型: 文本 默认值: 空 存放有 PEM 格式的受信任 SSL 证书颁发机构证书的文件夹。
-
$cfg['Servers'][$i]['ssl_ciphers']
¶ 类型: 文本 默认值: 空 通过 SSL 连接到 MySQL 服务器时可以使用的加密算法列表。
-
$cfg['Servers'][$i]['ssl_verify']
¶ 类型: 布尔值 默认值: true 4.6.0 新版功能: 自phpMyAdmin 4.6.0起支持此功能。
如果您的PHP安装使用MySQL本机驱动程序(mysqlnd),您的MySQL服务器是5.6或更高版本,并且您的SSL证书是自签名的,那么您的SSL连接可能会因验证而失败。将其设置为``false``将禁用验证检查。
从PHP 5.6.0开始,它还验证服务器名称是否与其证书的CN匹配。目前无法在不禁用完整SSL验证的情况下禁用此检查。
警告
禁用证书验证会失去使用SSL的意义。这将使连接易受中间人攻击。
注解
此标志仅适用于PHP 5.6.16或更高版本。
参见
使用SSL连接到数据库服务器, 使用 SSL 的 Google Cloud SQL, Amazon RDS Aurora with SSL,
$cfg['Servers'][$i]['ssl']
,$cfg['Servers'][$i]['ssl_key']
,$cfg['Servers'][$i]['ssl_cert']
,$cfg['Servers'][$i]['ssl_ca']
,$cfg['Servers'][$i]['ssl_ca_path']
,$cfg['Servers'][$i]['ssl_ciphers']
,$cfg['Servers'][$i]['ssl_verify']
-
$cfg['Servers'][$i]['connect_type']
¶ 类型: 文本 默认值: 'tcp'
4.7.0 版后已移除: 从4.7.0开始不再使用此设置,因为MySQL根据主机决定连接类型,因此可能会导致意外结果。请相应地设置
$cfg['Servers'][$i]['host']
选项。设置如何连接到 MySQL 服务器。您可以选择
'socket'
或'tcp'
。默认为 tcp,因为几乎所有的 MySQL 服务器都支持,而有些平台是不支持套接字的。要使用套接字方式连接,您的 MySQL 服务器必须和网站服务器在同一台服务器上。
-
$cfg['Servers'][$i]['compress']
¶ 类型: 布尔值 默认值: false 设置是否使用压缩协议连接到 MySQL 服务器(试验性的)。
-
$cfg['Servers'][$i]['controlhost']
¶ 类型: 文本 默认值: ''
设置使用一个其它的主机来保存高级功能的数据。
-
$cfg['Servers'][$i]['controlport']
¶ 类型: 文本 默认值: ''
设置通过一个其它的端口来连接到保存高级功能数据的主机。
-
$cfg['Servers'][$i]['controluser']
¶ 类型: 文本 默认值: ''
-
$cfg['Servers'][$i]['controlpass']
¶ 类型: 文本 默认值: ''
这个特殊账户用于访问 phpMyAdmin配置存储。在单用户案例中不需要它,但如果共享phpMyAdmin,建议只向该用户授予对 phpMyAdmin配置存储 的访问权限,并配置phpMyAdmin使用它。然后,所有用户都可以使用这些功能,而无需直接访问 phpMyAdmin配置存储。
在 2.2.5 版更改: 它们叫做``stduser``和``stdpass``
-
$cfg['Servers'][$i]['control_*']
¶ 类型: mixed 4.7.0 新版功能.
您可以使用前缀为``control_``的配置更改控件链接的任何MySQL连接设置(用于访问 phpMyAdmin配置存储)。
这可以用于更改控件连接的任何方面,默认情况下使用与用户相同的参数。
例如,您可以为控件连接配置SSL:
// Enable SSL $cfg['Servers'][$i]['control_ssl'] = true; // Client secret key $cfg['Servers'][$i]['control_ssl_key'] = '../client-key.pem'; // Client certificate $cfg['Servers'][$i]['control_ssl_cert'] = '../client-cert.pem'; // Server certification authority $cfg['Servers'][$i]['control_ssl_ca'] = '../server-ca.pem';
参见
$cfg['Servers'][$i]['ssl']
,$cfg['Servers'][$i]['ssl_key']
,$cfg['Servers'][$i]['ssl_cert']
,$cfg['Servers'][$i]['ssl_ca']
,$cfg['Servers'][$i]['ssl_ca_path']
,$cfg['Servers'][$i]['ssl_ciphers']
,$cfg['Servers'][$i]['ssl_verify']
,$cfg['Servers'][$i]['socket']
,$cfg['Servers'][$i]['compress']
,$cfg['Servers'][$i]['hide_connection_errors']
-
$cfg['Servers'][$i]['auth_type']
¶ 类型: 文本 默认值: 'cookie'
设置该服务器是使用 config 还是 cookie 还是 HTTP 还是 signon 认证方式。
- ‘config’ 认证方式(
$auth_type = 'config'
)是最原始的方法:将用户名和密码保存在config.inc.php
中。 - ‘cookie’认证方式(
$auth_type = 'cookie'
)将借助cookie允许您使用任何有效的 MySQL 用户登录。 - ‘http’ 基本认证方式将允许您通过http认证使用任何有效的 MySQL 用户登录。
- ‘signon’ 认证方式(
$auth_type = 'signon'
)将允许您从准备好的PHP会话数据或使用提供的PHP脚本登录。
参见
- ‘config’ 认证方式(
-
$cfg['Servers'][$i]['auth_http_realm']
¶ 类型: 文本 默认值: ''
在 auth_type =
http
时,您可以通过该项设置一个自定义的 HTTP 基本认证提示信息给用户。若不设置,将使用“phpMyAdmin ”加上$cfg['Servers'][$i]['verbose']
或$cfg['Servers'][$i]['host']
。
-
$cfg['Servers'][$i]['auth_swekey_config']
¶ 类型: 文本 默认值: ''
3.0.0.0 新版功能: 此设置名为“$cfg[‘Servers’][$i][‘auth_feebee_config’]”,并在’3.0.0.0’发布之前重命名。
4.6.4 版后已移除: 此设置已被删除,因为他们的服务器不再工作,并且无法正常工作。
4.0.10.17 版后已移除: 此设置已在维护版本中删除,因为他们的服务器不再工作,并且无法正常工作。
包含用于硬件身份验证的密钥ID和登录名的文件名。留空可停用此功能。
-
$cfg['Servers'][$i]['user']
¶ 类型: 文本 默认值: 'root'
-
$cfg['Servers'][$i]['password']
¶ 类型: 文本 默认值: ''
使用
$cfg['Servers'][$i]['auth_type']
时设置为’config’,这是phpMyAdmin用来连接MySQL服务器的用户/密码对。在 HTTP 或cookie身份验证的时候不需要此用户/密码对,并且应为空。
-
$cfg['Servers'][$i]['nopassword']
¶ 类型: 布尔值 默认值: false 4.7.0 版后已移除: 此设置已删除,因为它可能会产生意外结果。
设置使用密码登录失败时是否允许尝试使用空密码登录。可与 http 认证同时使用,或通过其他方式完成认证使得 phpMyAdmin 取得用户名及空密码来连接到 MySQL 。然而总是会先尝试使用密码登录的。
注解
It is possible to allow logging in with no password with the
$cfg['Servers'][$i]['AllowNoPassword']
directive.
-
$cfg['Servers'][$i]['only_db']
¶ 类型: 字符串或数组 默认值: ''
设置一个 (或一组) 数据库名,用户只能看到这些数据库。自 phpMyAdmin 2.2.1 起,数据库名可以包含 MySQL 通配符 (“_” 和 “%”): 如果你想使用这些字符本身,请转义它们 (即: 要使用
'my\_db'
而不是'my_db'
)。此设置可有效降低服务器的负载,因为不需要向 MySQL 发送构建可用数据库列表的请求。但**它并不能取代 MySQL 数据库服务器的权限规则**。这仅意味着这些数据库被显示出来而已,而**不是说没有显示出来的数据库都不能用。**
使用多个数据库的示例:
$cfg['Servers'][$i]['only_db'] = ['db1', 'db2'];
在 4.0.0 版更改: 以前的版本允许通过此指令指定数据库名称的显示顺序。
-
$cfg['Servers'][$i]['hide_db']
¶ 类型: 文本 默认值: ''
对非特权用户隐藏数据库的正则表达式。 这仅仅将数据库从列表中隐藏,用户仍然可以直接访问 (如通过 SQL 查询)。要彻底限制访问,请使用 MySQL 权限系统。例如,要隐藏所有开头字母是a的数据库,使用
$cfg['Servers'][$i]['hide_db'] = '^a';
同时隐藏db1和db2,使用
$cfg['Servers'][$i]['hide_db'] = '^(db1|db2)$';
可以在 PHP 手册的 PCRE正则语法<https://secure.php.net/manual/zh/reference.pcre.pattern.syntax.php> 一节中找到更多关于正则表达式的信息。
-
$cfg['Servers'][$i]['verbose']
¶ 类型: 文本 默认值: ''
仅在通过 phpMyAdmin 管理多个服务器时有用。主页的下拉菜单中将用此值代替主机名。如果你想只显示系统中部分数据库时也有用,如,使用 HTTP 认证时,所有非 ASCII 字符都将被删除。
-
$cfg['Servers'][$i]['extension']
¶ 类型: 文本 默认值: 'mysqli'
4.2.0 版后已移除: 此设置已删除。仅当``mysqli``扩展名不可用时才会使用``mysql``扩展名。从5.0.0开始,只能使用``mysqli``扩展名。
要使用的PHP MySQL扩展(
mysql``或``mysqli
)。建议在所有安装中使用``mysqli``。
-
$cfg['Servers'][$i]['pmadb']
¶ 类型: 文本 默认值: ''
包含 phpMyAdmin 高级功能数据的数据库名。
参见 phpMyAdmin配置存储 一节了解其好处以及如何快速创建该数据库和需要的数据表。
如果此 phpMyAdmin 只有你自己使用,你可以用你当前的数据库来保存这些特殊的数据表,这种情况下,你可以在
$cfg['Servers'][$i]['pmadb']
中填写当前数据库的名字。若此 phpMyAdmin 作为多用户使用,请设为包含 phpMyAdmin 高级功能数据表的专用数据库。
-
$cfg['Servers'][$i]['bookmarktable']
¶ 类型: 字符串或“false” 默认值: ''
2.2.0 新版功能.
自 2.2.0 起 phpMyAdmin 允许用户将查询加入书签。你可以将经常要执行的语句加入书签。要允许使用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 在
$cfg['Servers'][$i]['bookmarktable']
中设置数据表名
可以通过将配置设置为``false``来禁用此功能。
- 设置好
-
$cfg['Servers'][$i]['relation']
¶ 类型: 字符串或“false” 默认值: ''
2.2.4 新版功能.
自 2.2.4 起你可以在 ‘relation’ 表的支持下定义一张表中的一个字段与另一张表的关系 (外键)。目前 phpMyAdmin 将它用于:
- 使外键数据可点击,浏览主表时可通过点击数据值转到外表;
- 在浏览主表时,当鼠标移到含有外键的字段上用气泡提示显示可选的“显示的字段” (需同时使用 ‘table_info’ 表) ;(参见 6.7 怎样使用 “显示字段” 功能?)
- 在编辑/插入时,显示可能的外键下拉列表 (显示为键值和"显示的字段") (参见 6.21 怎样才能在编辑/插入模式中看见某个字段基于外键表的可能的值的列表?)
- 在表的属性页上为每个键显示检查参照完整性的链接(用于显示缺失的外键);
- 通过依例查询自动创建关联查询 (参见 6.6 怎样在依例查询 (Query-by-example) 中使用关系表?)
- 生成 PDF 格式的数据库大纲 (需同时使用 table_coords 表)。
字段值可以是数字或者字符。
要启用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 在
$cfg['Servers'][$i]['relation']
中设置要使用的数据表名 - 现在以普通用户登录到 phpMyAdmin 并打开每一张你想要使用这个功能的数据表,点击:guilabel:结构/关系查看/ 并设置外键字段。
可以通过将配置设置为``false``来禁用此功能。
注解
请注意在当前版本中
master_db
必须和foreign_db
一致。这两个字段是为后期跨数据库关系开发预留的。
-
$cfg['Servers'][$i]['table_info']
¶ 类型: 字符串或“false” 默认值: ''
2.3.0 新版功能.
自 2.3.0 起你可以在一个特殊的 ‘table_info’ 表的支持下设置当鼠标移到对应字段时用气泡提示显示出来的相应内容。此配置变量将保留此特殊表的名称。要允许使用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 在
$cfg['Servers'][$i]['table_info']
中设置要使用的数据表名 (如:’pma_table_info’) - 对每一张你要使用此功能的数据表,点击“结构/关系查看/选择要显示的字段”设置好显示的字段。
可以通过将配置设置为``false``来禁用此功能。
- 设置好
-
$cfg['Servers'][$i]['table_coords']
¶ 类型: 字符串或“false” 默认值: ''
设计器功能可以保存您的页面布局;通过在展开的设计器菜单中按“保存页面”或“将页面另存为”按钮,您可以自定义布局并在下次使用设计器时加载它。该布局存储在此表中。此外,使用PDF关系导出功能也需要此表,请参阅
$cfg['Servers'][$i]['pdf_pages']
以获取更多详细信息。
-
$cfg['Servers'][$i]['pdf_pages']
¶ 类型: 字符串或“false” 默认值: ''
2.3.0 新版功能.
自 2.3.0 版本起你可以用 phpMyAdmin 创建 PDF 页面来显示各数据表之间的关系。要实现这个功能需要两张数据表, “pdf_pages” (保存可用 PDF 页的信息) 和 “table_coords” (保存每张表在 PDF 大纲输出中的坐标)。您必须使用“关系”功能。
要启用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 在
$cfg['Servers'][$i]['table_coords']
和$cfg['Servers'][$i]['pdf_pages']
中设置要使用的数据表名
可以通过将任一配置设置为``false``来禁用此功能。
- 设置好
-
$cfg['Servers'][$i]['designer_coords']
¶ 类型: 文本 默认值: ''
2.10.0 新版功能: 自 2.10.0 起可以通过设计器可视化地管理关系。
4.3.0 版后已移除: 此设置已被删除,设计器表格定位数据现在存储到
$cfg['Servers'][$i]['table_coords']
。注解
现在你可以从你的 phpMyAdmin 配置存储数据库中删除`pma__designer_coords`表,并从你的配置文件中删除 :config:option:`$cfg[‘Servers’][$i][‘designer_coords’]’。
-
$cfg['Servers'][$i]['column_info']
¶ 类型: 字符串或“false” 默认值: ''
2.3.0 新版功能.
这部分需要更新内容! 自 2.3.0 起您可以存储注释来描述每个表的每个列。然后这些将显示在“打印视图”上。
从版本2.5.0开始,注释因此在表属性页面和表浏览视图中使用,在列名称(属性页面)上方显示为工具提示或嵌入在浏览视图中的表头中。它们也可以显示在表转储中。请稍后查看相关的配置指令。
自 2.5.0 起 MIME 类型转换系统同样基于下列数据表结构。详情请参见 转换。要想使用 MIME 类型转换系统,column_info 表必须有这三个新字段 ‘mimetype’、’transformation’ 和 ‘transformation_options’ 。
从4.3.0版开始,引入了一种新的面向输入的转换系统。此外,删除了旧转换系统中使用的向后兼容性代码。因此,对于先前的转换和新的面向输入的转换系统来说,必须更新column_info表。 phpMyAdmin将通过分析您当前的column_info表结构自动为您升级它。但是,如果自动升级出现问题,那么您可以使用``./sql/upgrade_column_info_4_3_0+.sql``中的SQL脚本手动升级它。
要启用此功能:
设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储在
$cfg['Servers'][$i]['column_info']
中设置要使用的数据表名 (如:pma__column_info
)要更新你的PRE-2.5.0 Column_comments表,使用这个: 并记住
config.inc.php`中的变量已从 :samp:`$cfg['Servers'][$i]['column_comments']
被重命名到$cfg['Servers'][$i]['column_info']
ALTER TABLE `pma__column_comments` ADD `mimetype` VARCHAR( 255 ) NOT NULL, ADD `transformation` VARCHAR( 255 ) NOT NULL, ADD `transformation_options` VARCHAR( 255 ) NOT NULL;
要手动更新PRE-4.3.0 Column_info表,使用这个``./sql/upgrade_column_info_4_3_0+.sql``SQL脚本。
可以通过将配置设置为``false``来禁用此功能。
注解
要使自动升级功能正常工作,你的
$cfg['Servers'][$i]['controluser']
必须对``phpmyadmin``数据库具有ALTER权限。有关如何为用户提供``GRANT``特权,请参阅`GRANT的MySQL文档 <https://dev.mysql.com/doc/refman/8.0/en/grant.html>` 。
-
$cfg['Servers'][$i]['history']
¶ 类型: 字符串或“false” 默认值: ''
2.5.0 新版功能.
自 2.5.0 起你可以保存在 phpMyAdmin 中输入的 SQL 查询历史,即存储您手动输入到phpMyAdmin界面的所有查询。如果你不想使用基于数据表的历史记录,也可以使用基于 JavaScript 的历史记录。
使用它,关闭窗口时将删除所有历史记录项。通过
$cfg['QueryHistoryMax']
可以定义保存历史记录的最大数量。过量历史记录的删除操作将在每次登录时执行。查询历史仅在浏览器启用 JavaScript 时可用。
要启用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 把表名放在
$cfg['Servers'][$i]['history']
(例如``pma__history``)
可以通过将配置设置为``false``来禁用此功能。
- 设置好
-
$cfg['Servers'][$i]['recent']
¶ 类型: 字符串或“false” 默认值: ''
3.5.0 新版功能.
从版本3.5.0开始,您可以在导航面板中显示最近使用的表格。它可以帮助您直接跳过表,而无需选择数据库,然后选择表。使用
$cfg['NumRecentTables']
您可以配置显示的最近表的最大数量。当您从列表中选择一个表时,它将跳转到$cfg['NavigationTreeDefaultTabTable']
当中指定的页面。如果不配置存储,您仍然可以访问最近使用的表,但在注销后它将消失。
要永久允许使用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 把表名放在
$cfg['Servers'][$i]['recent']
(如:pma__recent
)
可以通过将配置设置为``false``来禁用此功能。
- 设置好
-
$cfg['Servers'][$i]['favorite']
¶ 类型: 字符串或“false” 默认值: ''
4.2.0 新版功能.
从版本4.2.0开始,您可以在导航面板中显示所选表的列表。它可以帮助您直接跳转到表,而无需选择数据库,然后选择表。当您从列表中选择一个表时,它将跳转到
$cfg['NavigationTreeDefaultTabTable']
当中指定的页面。您可以通过单击表名旁边的星形图标将表添加到此列表或从数据库结构页中删除表。使用
$cfg['NumFavoriteTables']
你可以配置显示的最喜欢的表数。如果不配置存储,您仍然可以访问收藏表,但在注销后它将消失。
要永久允许使用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 把表名放在
$cfg['Servers'][$i]['favorite']
(例如``pma__favorite``)
可以通过将配置设置为``false``来禁用此功能。
- 设置好
-
$cfg['Servers'][$i]['table_uiprefs']
¶ 类型: 字符串或“false” 默认值: ''
3.5.0 新版功能.
从版本3.5.0开始,phpMyAdmin可以配置为记住几个事项(排序列
$cfg['RememberSorting']
,列顺序和数据库表中的列可见性)用于浏览表。如果不配置存储,仍可以使用这些功能,但注销后值将消失。允许持久使用这些功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 把表名放在
$cfg['Servers'][$i]['table_uiprefs']
(例如``pma__table_uiprefs``)
可以通过将配置设置为``false``来禁用此功能。
- 设置好
-
$cfg['Servers'][$i]['users']
¶ 类型: 字符串或“false” 默认值: ''
phpmyadmin是一个表,用于将用户名信息与用户组相关联。详细信息和推荐设置是:CONFIG:选项:选择:`$ CFG [‘服务器’] [$ i] [‘usergroups’oppers。
-
$cfg['Servers'][$i]['usergroups']
¶ 类型: 字符串或“false” 默认值: ''
4.1.0 新版功能.
从4.1.0版开始,您可以创建不同的用户组,并附加菜单项。可以将用户分配给这些组,并且登录用户只能看到配置给他分配给的用户组的菜单项。为此,它需要两个表“usergroups”(为每个用户组存储允许的菜单项)和“users”(将用户及其分配存储到用户组)。
要启用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 将正确的表名放在
$cfg['Servers'][$i]['users']
(如``pma__users``)和$cfg['Servers'][$i]['usergroups']
(如``pma__usergroups``)
可以通过将任一配置设置为``false``来禁用此功能。
参见
- 设置好
类型: 字符串或“false” 默认值: ''
4.1.0 新版功能.
从4.1.0版开始,您可以隐藏/显示导航树中的项目。
要启用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 在
$cfg['Servers'][$i]['navigationhiding']
中设置要使用的数据表名 (如:pma__navigationhiding
)
可以通过将配置设置为``false``来禁用此功能。
- 设置好
-
$cfg['Servers'][$i]['central_columns']
¶ 类型: 字符串或“false” 默认值: ''
4.3.0 新版功能.
4.3.0版开始,您可以拥有每个数据库的列的中央列表。您可以根据需要在列表中添加/删除列。在为表创建新列或创建表本身时,可以使用中央列表中的这些列。您可以在创建新列时从中央列表中选择一列,这样可以避免再次编写相同的列定义或者为类似列编写不同的名称。
要启用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 在
$cfg['Servers'][$i]['central_columns']
中设置要使用的数据表名 (如:pma__central_columns
)
可以通过将配置设置为``false``来禁用此功能。
- 设置好
-
$cfg['Servers'][$i]['designer_settings']
¶ 类型: 字符串或“false” 默认值: ''
4.5.0 新版功能.
自发布 4.5.0 之后,您可以保存设计器设置。您选择的“折角/直接连接”、“吸附到网格”、“切换关系线”、“全部调小/大”、“移动菜单”和“固定住文本”选项可以永久保存下来。
要启用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 在
$cfg['Servers'][$i]['designer_settings']
中设置要使用的数据表名 (如:pma__designer_settings
)
可以通过将配置设置为``false``来禁用此功能。
- 设置好
-
$cfg['Servers'][$i]['savedsearches']
¶ 类型: 字符串或“false” 默认值: ''
4.2.0 新版功能.
从版本4.2.0开始,您可以从“数据库”>“查询”面板中保存并加载按示例搜索的搜索。
要启用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 在
$cfg['Servers'][$i]['tracking']
中设置要使用的数据表名 (如:pma_tracking
)
可以通过将配置设置为``false``来禁用此功能。
- 设置好
-
$cfg['Servers'][$i]['export_templates']
¶ 类型: 字符串或“false” 默认值: ''
4.5.0 新版功能.
自发布 4.5.0 以后,你可以保存和读取导出的模板。
要启用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 在
$cfg['Servers'][$i]['export_templates']
中设置要使用的数据表名 (如:pma__export_templates
)
可以通过将配置设置为``false``来禁用此功能。
- 设置好
-
$cfg['Servers'][$i]['tracking']
¶ 类型: 字符串或“false” 默认值: ''
3.3.x 新版功能.
自 3.3.x 起可以使用追踪功能。它可以帮你追踪每个通过 phpMyAdmin 执行的 SQL 命令。它支持记录数据修改和数据定义语句。启用后还可以创建数据表的版本。
创建版本会造成两个影响:
- phpMyAdmin 保存当前数据表的快照,包括结构和索引。
- phpMyAdmin 针对当前数据表记录的所有修改结构和/或数据的命令都将与版本关联。
当然你也能查看追踪到的修改。在”追踪”页里每个版本都会有一份完整的报告。你可以在报告中搜索,如你可以只列出一段时间内的语句。若想根据用户名搜索可以输入 * 表示任意用户或者输入 ‘,’ 分隔的用户列表。你还可以导出 (包括搜索结果) 报告为文件或者临时数据库。
要启用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 在 :config:option:`$cfg[‘Servers’][$i][‘tracking’] 中设置要使用的数据表名 (如:’pma_tracking’)
可以通过将配置设置为``false``来禁用此功能。
-
$cfg['Servers'][$i]['tracking_version_auto_create']
¶ 类型: 布尔值 默认值: false 设置追踪系统是否自动为数据表和视图创建版本。
若设为 true 然后你通过
- CREATE TABLE …
- CREATE VIEW …
创建了一张表或视图并且它当前没有任何版本,系统将会自动为你创建一个版本。
-
$cfg['Servers'][$i]['tracking_default_statements']
¶ 类型: 文本 默认值: 'CREATE TABLE,ALTER TABLE,DROP TABLE,RENAME TABLE,CREATE INDEX,DROP INDEX,INSERT,UPDATE,DELETE,TRUNCATE,REPLACE,CREATE VIEW,ALTER VIEW,DROP VIEW,CREATE DATABASE,ALTER DATABASE,DROP DATABASE'
定义自动创建新版的命令列表。
-
$cfg['Servers'][$i]['tracking_add_drop_view']
¶ 类型: 布尔值 默认值: true 设置当记录视图创建时,是否在前面加上 ‘DROP VIEW IF EXISTS’ 命令。
-
$cfg['Servers'][$i]['tracking_add_drop_table']
¶ 类型: 布尔值 默认值: true 设置当记录数据表创建时,是否在前面加上 ‘DROP TABLE IF EXISTS’ 命令。
-
$cfg['Servers'][$i]['tracking_add_drop_database']
¶ 类型: 布尔值 默认值: true 设置当记录数据库创建时,是否在前面加上 ‘DROP DATABASE IF EXISTS’ 命令。
-
$cfg['Servers'][$i]['userconfig']
¶ 类型: 字符串或“false” 默认值: ''
3.4.x 新版功能.
自 3.4.x 起 phpMyAdmin 允许用户自己设置大部分偏好并将设置保存在数据库中。
如果你不想让用户将偏好保存在
$cfg['Servers'][$i]['pmadb']
中,用户仍然可以个性化 phpMyAdmin,但设置将会保存在浏览器本地存储中,或者,会话不可用,直到会话结束。要启用此功能:
- 设置好
$cfg['Servers'][$i]['pmadb']
和 phpMyAdmin 配置存储 - 在
$cfg['Servers'][$i]['userconfig']
中设置要使用的数据表名
可以通过将配置设置为``false``来禁用此功能。
- 设置好
-
$cfg['Servers'][$i]['MaxTableUiprefs']
¶ 类型: 整数 默认值: 100 保存在:config:option:`$cfg[‘Servers’][$i][‘table_uiprefs’]`table中的最大行数。
当删除或重命名表时,
$cfg['Servers'][$i]['table_uiprefs']
可能包含无效数据(指不再存在的表)。我们只在$cfg['Servers'][$i]['table_uiprefs']
中保留这个最新的行数,然后自动删除旧的行。
-
$cfg['Servers'][$i]['SessionTimeZone']
¶ 类型: 文本 默认值: ''
设置 phpMyAdmin 所使用的时区。留空将使用数据库服务器的时区。可能的值在 https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html 中说明
当您的数据库服务器使用的时区不同于您要在 phpMyAdmin 中使用的时区时,这非常有用。
-
$cfg['Servers'][$i]['AllowRoot']
¶ 类型: 布尔值 默认值: true 设置是否允许 root 用户访问。此为
$cfg['Servers'][$i]['AllowDeny']['rules']
的快速设置。
-
$cfg['Servers'][$i]['AllowNoPassword']
¶ 类型: 布尔值 默认值: false 设置是否允许不使用密码登录。为了防止可能存在空密码的 root 或者其他匿名 (空) 用户访问到 MySQL 服务器,此项默认为
false
。
-
$cfg['Servers'][$i]['AllowDeny']['order']
¶ 类型: 文本 默认值: ''
若不指定规则顺序,IP 认证将不可用。
若将规则顺序设为``’deny,allow’``,系统将首先应用所有的禁止 (deny) 规则,然后再应用允许规则 (allow) 。默认允许访问,任何没有被 Deny (禁止) 命令匹配的客户端或者被 Allow (允许) 命令匹配的客户端将被允许访问服务器。
若将规则顺序设为
'allow,deny'
,系统将首先应用所有的允许 (allow) 规则,然后再应用禁止 (deny) 规则。默认禁止访问,任何没有被 Allow (允许) 命令匹配的客户端或者被 Deny (禁止) 命令匹配的客户端将被禁止访问服务器。若将规则顺序设为
'explicit'
,认证行为与设为 ‘deny,allow’ 相似,但同时额外要求主机/用户名组合**必须**在**允许 (allow)** 规则中列出且不能在**禁止 (deny)** 规则中出现。这是**最**安全的方式,并且相当于在 Apache 中使用允许 (allow)、禁止 (deny) 规则但不指定顺序时的效果。同时请参见
$cfg['TrustedProxies']
探测使用代理的真实 IP 。
-
$cfg['Servers'][$i]['AllowDeny']['rules']
¶ 类型: 字符串数组 默认值: array() 规则的格式通常为:
<'allow' | 'deny'> <username> [from] <ipmask>
如果要匹配所有用户,请在*用户名*一栏中使用通配符
'%'
。有几个 IP 地址掩码 一栏的缩写可以使用(请注意包含 SERVER_ADDRESS 的条目可能对某些网站服务器无效):
'all' -> 0.0.0.0/0 'localhost' -> 127.0.0.1/8 'localnetA' -> SERVER_ADDRESS/8 'localnetB' -> SERVER_ADDRESS/16 'localnetC' -> SERVER_ADDRESS/24
在规则顺序为
'deny,allow'
时,空的规则列表等价于'allow % from all'
;规则顺序为'allow,deny'
或'explicit'
时等价于'deny % from all'
。对于 :IP 地址 匹配系统来说,下列形式是有效的:
xxx.xxx.xxx.xxx
(一个具体的 :term:`IP`地址)xxx.xxx.xxx.[yyy-zzz]
(一个 IP 地址 范围)xxx.xxx.xxx.xxx/nn
(CIDR,无类别域间路由类型的 IP 地址范围)
而下列形式是无效的:
xxx.xxx.xxx.xx[yyy-zzz]
(部分 IP 地址范围)
对于 :term:`IPv6`地址,下列形式是有效的:
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
(一个具体的 IPv6 地址)xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:[yyyy-zzzz]
(一段 IPv6 地址范围)xxxx:xxxx:xxxx:xxxx/nn
(CIDR,无类别域间路由类型的 IPv6 地址范围)
而下列形式是无效的:
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xx[yyy-zzz]
(部分 IPv6 地址范围)
如:
$cfg['Servers'][$i]['AllowDeny']['order'] = 'allow,deny'; $cfg['Servers'][$i]['AllowDeny']['rules'] = ['allow bob from all']; // Allow only 'bob' to connect from any host $cfg['Servers'][$i]['AllowDeny']['order'] = 'allow,deny'; $cfg['Servers'][$i]['AllowDeny']['rules'] = ['allow mary from 192.168.100.[50-100]']; // Allow only 'mary' to connect from host 192.168.100.50 through 192.168.100.100 $cfg['Servers'][$i]['AllowDeny']['order'] = 'allow,deny'; $cfg['Servers'][$i]['AllowDeny']['rules'] = ['allow % from 192.168.[5-6].10']; // Allow any user to connect from host 192.168.5.10 or 192.168.6.10 $cfg['Servers'][$i]['AllowDeny']['order'] = 'allow,deny'; $cfg['Servers'][$i]['AllowDeny']['rules'] = ['allow root from 192.168.5.50','allow % from 192.168.6.10']; // Allow any user to connect from 192.168.6.10, and additionally allow root to connect from 192.168.5.50
-
$cfg['Servers'][$i]['DisableIS']
¶ 类型: 布尔值 默认值: false 设置是否禁止通过
INFORMATION_SCHEMA
来获取信息(用SHOW
命令代替),若不禁止且数据库很多时可能会造成性能下降。注解
启用该选项可能会让您的老 MySQL 服务器的性能得到大幅度提升。
-
$cfg['Servers'][$i]['SignonScript']
¶ 类型: 文本 默认值: ''
3.5.0 新版功能.
获取登录凭证所需的源代码和执行的PHP脚本的名称。这是基于会话的单点登录的替代方法。脚本必须提供一个名为“get_login_credentials”的函数,该函数返回用户名和密码列表,接受现有用户名的单个参数(可以为空)。请参阅:file:examples/signon-script.php 例如:
<?php /** * Single signon for phpMyAdmin * * This is just example how to use script based single signon with * phpMyAdmin, it is not intended to be perfect code and look, only * shows how you can integrate this functionality in your application. */ declare(strict_types=1); // phpcs:disable Squiz.Functions.GlobalFunction /** * This function returns username and password. * * It can optionally use configured username as parameter. * * @param string $user User name * * @return array<int,string> */ function get_login_credentials(string $user): array { /* Optionally we can use passed username */ if (! empty($user)) { return [$user, 'password']; } /* Here we would retrieve the credentials */ return ['root', '']; }
参见
-
$cfg['Servers'][$i]['SignonSession']
¶ 类型: 文本 默认值: ''
用于登录身份验证方法的会话的名称。名称``phpmyadmin``是phpmyadmin在内部使用的会话,因此它必须使用不同的名称。:Config:选项:`$ CFG [‘服务器’] [$ i] [‘sengsonecript’]如果您不取消,这将无法正常工作。
参见
-
$cfg['Servers'][$i]['SignonCookieParams']
¶ 类型: 数组 默认值: array()
4.7.0 新版功能.
其他身份验证系统的会话cookie参数关联数组。如果未使用session_set_cookie_params(),则不需要其他身份验证系统。该密钥指定了“生命周期”,“路径”,“域”,“安全”,“HttpOnly”。有效值在`session_get_cookie_params <https://www.php.net/manual/en/function.session-get-cookie-params.php>`_中介绍了有效值。:Config:选项:`$ CFG [‘服务器’] [$ i] [$ i] [‘sengsonscript’]才有效,只有在未设置’signarecript’’’。
参见
-
$cfg['Servers'][$i]['LogoutURL']
¶ 类型: 文本 默认值: ''
使用 signon 认证时用户退出后将转到的 :term:`URL`(不影响配置中的认证方法)。应为包含协议的绝对地址。
-
$cfg['Servers'][$i]['hide_connection_errors']
¶ 类型: 布尔值 默认值: false 4.9.8 新版功能.
是否在登录页面上显示或隐藏详细的MySQL/MariaDB连接错误。
注解
此错误消息可能包含目标数据库服务器主机名或IP地址,这可能会向攻击者泄露有关网络的信息。
基本设置¶
-
$cfg['DisableShortcutKeys']
¶ 类型: 布尔值 默认值: false 您可以通过设置 $cfg[‘DisableShortcutKeys’] 为 true 禁用 phpMyAdmin 快捷键。
-
$cfg['ServerDefault']
¶ 类型: 整数 默认值: 1 如果有多个服务器设置,你可以设置
$cfg['ServerDefault']
为其中之一,phpMyAdmin 将会自动连接,若设为 0 则将在登录页面显示服务器列表。如果只有一个服务器设置,
$cfg['ServerDefault']
必须设为那台服务器。
-
$cfg['VersionCheck']
¶ 类型: 布尔值 默认值: true 允许在 phpMyAdmin 主页面中使用 JavaScript 或通过直接访问 index.php?route=/version-check 检查新版本。
注解
此设置可能会更改供应商。
-
$cfg['ProxyUrl']
¶ 类型: 文本 默认值: ''
当phpmyadmin需要访问外部internet时(例如检索最新版本信息或提交错误报告时),要使用的代理的url。如果安装了phpMyAdmin的服务器无法直接访问internet,则需要此选项。格式为:“主机名:端口号”
-
$cfg['ProxyUser']
¶ 类型: 文本 默认值: ''
连接代理服务器时使用的用户名。如果提供用户名,将使用基本认证方式连接。目前还不支持其他认证方式。
-
$cfg['ProxyPass']
¶ 类型: 文本 默认值: ''
代理服务的密码.
-
$cfg['MaxDbList']
¶ 类型: 整数 默认值: 100 主面板上数据库列表显示数据库名称的最大数量。
-
$cfg['MaxTableList']
¶ 类型: 整数 默认值: 250 主面板显示表格名称的最大数量(除了导出页面外)。
-
$cfg['ShowHint']
¶ 类型: 布尔值 默认值: true 是否显示提示(当鼠标光标重叠在表格零件上时显示)。
-
$cfg['MaxCharactersInDisplayedSQL']
¶ 类型: 整数 默认值: 1000 显示 SQL 查询的最大字数。默认值 1000 通常可以避免 BLOB 字段中十六进制内容的显示,但有些用户确实有超过 1000 个字符的 SQL 查询。另外,如果一个查询超过了这个限制,也将不会保存在查询历史中。
-
$cfg['PersistentConnections']
¶ 类型: 布尔值 默认值: false 是否使用 `持久连接<https://www.php.net/manual/en/features .persistent-connections.php>`_ 。
-
$cfg['ForceSSL']
¶ 类型: 布尔值 默认值: false 4.6.0 版后已移除: PHPMYADMIN 4.6.0后,此设置无效。请设置Web服务器。
设置在访问 phpMyAdmin 时是否强制使用 https 安全连接。在反向代理配置中,不支持将此选项设置为
true
。注解
在某些设置(如分离的SSL代理,负载均衡)中,需要设置
$cfg['PmaAbsoluteUri']
以获得正确的重定向。
-
$cfg['MysqlSslWarningSafeHosts']
¶ 类型: 数组 默认值: ['127.0.0.1', 'localhost']
此搜索区分大小写,仅搜索严格的匹配字符串。如果您未使用SSL,则知道使用本地连接或专用网络是安全的,您可以添加主机名或:术语:`IP`地址到列表。您还可以删除默认项目,仅包含您的项目。
这个检查使用
$cfg['Servers'][$i]['host']
的值。5.1.0 新版功能.
示例配置
$cfg['MysqlSslWarningSafeHosts'] = ['127.0.0.1', 'localhost', 'mariadb.local'];
-
$cfg['ExecTimeLimit']
¶ 类型: 整数 [单位: 秒] 默认值: 300 设置允许脚本运行的最长时间。如果设置为0,则不施加时间限制。此设置用于在 PHP 安全模式下导入/导出转储文件没有效果时调整。
-
$cfg['SessionSavePath']
¶ 类型: 文本 默认值: ''
保存会话数据的路径(PHP 参数 session_save_path )。
警告
不得通过Web服务器访问此文件夹。私有数据从会话泄漏存在风险。
-
$cfg['MemoryLimit']
¶ 类型: 字符串 [单位: 字节] 默认值: '-1'
设置脚本运行的可使用的内存大小。若设为
'-1'
则没有额外限制,若设为'0'
,则不尝试改变内存限制,且会应用php.ini
中memory_limit
配置项。本设置用于导入/导出转储文件以及 phpMyAdmin 的其他功能,所以显然不要设置一个很小的值。若 PHP 运行于安全模式则无效。
同样可以设置为
php.ini
文件可以识别的字符串,如 ‘16M’ 。请确保没有丢掉后缀(16 表示 16 字节!)
-
$cfg['SkipLockedTables']
¶ 类型: 布尔值 默认值: false 标记正在使用的表以使得可以显示含有已锁定表的数据库 (自 MySQL 3.23.30 起) 。
-
$cfg['CodemirrorEnable']
¶ 类型: 布尔值 默认值: true 定义是否在SQL查询框中使用JavaScript代码编辑器。Codemirror允许您显示语法强调和行号。但是,所有浏览器都不支持由几个Linux发行版(例如Ubuntu)提供的中间按钮的粘贴。
-
$cfg['LintEnable']
¶ 类型: 布尔值 默认值: true 4.5.0 新版功能.
定义在执行之前是否使用解析器查找查询中的任何错误。
-
$cfg['DefaultForeignKeyChecks']
¶ 类型: 文本 默认值: ``’默认’ 禁用/启用指定查询的外键检查这是外键复选框的复选框的默认值,可指定的值是
'默认'
,'启用'
,'禁用'
。当设置为'默认'
时,使用 MySQL 环境变量FOREIGN_KEY_CHECKS
的值。
-
$cfg['AllowUserDropDatabase']
¶ 类型: 布尔值 默认值: false 警告
这不是安全措施,因为它始终存在如何避免这种情况。如果用户想要禁用删除数据库,请禁用相应的丢弃权限。
设置普通用户 (非管理员) 是否可以删除他们自己的数据库。若设为 false,链接 删除数据库 将不会显示出来,
DROP DATABASE mydatabase
语句也会被拒绝。该功能对于有很多客户的 ISP 相当有用。请注意这里对 SQL 查询的限制并不能像使用 MySQL 权限限制那样严格。因为 SQL 查询可以非常复杂。所以该功能应作为避免误删除数据库而不是严格的权限限制来使用。
-
$cfg['Confirm']
¶ 类型: 布尔值 默认值: true 设置可能丢失数据时是否显示警告(“Are you really sure …”) 。
-
$cfg['UseDbSearch']
¶ 类型: 布尔值 默认值: true 设置是否允许使用 “数据库搜索” 。
-
$cfg['IgnoreMultiSubmitErrors']
¶ 类型: 布尔值 默认值: false 设置 phpMyAdmin 是否在执行多语句查询出错的时候继续执行。默认为中断执行。
-
$cfg['enable_drag_drop_import']
¶ 类型: 布尔值 默认值: true 是否启用了通过拖放的导入功能。如果用户将文件拖动到浏览器(如果已启用),PHPMyAdmin会尝试导入文件。
-
$cfg['URLQueryEncryption']
¶ 类型: 布尔值 默认值: false 4.9.8 新版功能.
设置 phpMyAdmin 是否对 URL 查询参数的敏感数据(如数据库名和表名)进行加密。默认不进行加密。
-
$cfg['URLQueryEncryptionSecretKey']
¶ 类型: 文本 默认值: ''
4.9.8 新版功能.
用于加密/解密URL查询字符串的密钥。应该是32字节长。
-
$cfg['maxRowPlotLimit']
¶ 类型: 整数 默认值: 500 从区域搜索获取的最大行数。
Cookie 认证选项¶
-
$cfg['blowfish_secret']
¶ 类型: 文本 默认值: ''
“cookie” 认证类型需要使用 Sodium 扩展加密(请查阅 Cookie)。若要使用 “cookie” 认证类型,需要设置一个随机的密钥。这是 Sodium 扩展内部使用的,以后也不会向你询问。
由于二进制字符串通常不可打印,因此可以将其转换为十六进制表示形式(使用类似 sodium_bin2hex 的函数),然后在配置文件中使用。例如:
// The string is a hexadecimal representation of a 32-bytes long string of random bytes. $cfg['blowfish_secret'] = sodium_hex2bin('f16ce59f45714194371b48fe362072dc3b019da7861558cd4ad29e4d6fb13851');
建议使用二进制字符串。但是,如果字符串的所有 32 个字节都是可见字符,则不需要像 sodium_bin2hex 这样的函数。例如:
// A string of 32 characters. $cfg['blowfish_secret'] = 'JOFw435365IScA&Q!cDugr!lSfuAz*OW';
警告
加密密钥的长度必须为 32 字节。如果它比字节长度长,则仅使用前 32 个字节,如果它更短,则会为你自动生成一个新的临时密钥。但是,此临时密钥只会在会话期间有效。
注解
此设置称为Blowfish_secret,此设置基于Blowfish算法最初用于加密的事实。
在 3.1.0 版更改: 自 3.1.0 起 phpMyAdmin 能在线生成,但因为密钥被保存在会话中,所以安全性相对较低,并且无法显示上次登录的用户名。
在 5.2.0 版更改: 从 5.2.0 版本开始,phpMyAdmin 使用 sodium_crypto_secretbox <https://www.php.net/sodium_crypto_secretbox> _ 和 sodium_crypto_secretbox_open PHP 函数来分别对 cookies 进行加密和解密。
-
$cfg['CookieSameSite']
¶ 类型: 文本 默认值: 'Strict'
5.1.0 新版功能.
它设置Set Cookie:term:`HTTP`响应头的SameSite属性。有效值为:
Lax
Strict
None
参见
-
$cfg['LoginCookieRecall']
¶ 类型: 布尔值 默认值: true 设置在 cookie 认证下是否能自动重复上次登录。
如果没有设置
$cfg['blowfish_secret']
该功能将自动禁用。
-
$cfg['LoginCookieValidity']
¶ 类型: 整数 [单位: 秒] 默认值: 1440 设置登录 cookie 的有效期。请注意 PHP 配置选项的 session.gc_maxlifetime 可能会限制会话有效期,若会话失效登录 cookie 同样会失效。所以最好将
session.gc_maxlifetime
设置为不小于$cfg['LoginCookieValidity']
的值。
-
$cfg['LoginCookieStore']
¶ 类型: 整数 [单位: 秒] 默认值: 0 设置登录 cookie 应在浏览器中保存多长时间。默认值 0 表示当前会话。建议在公共环境下使用。
-
$cfg['LoginCookieDeleteAll']
¶ 类型: 布尔值 默认值: true 若启用 (默认值),退出时将会删除所有服务器的 cookies,否则仅删除当前服务器的 cookies 。若设为 false,当你访问多台服务器时可能会容易忘记退出其它服务器。
-
$cfg['AllowArbitraryServer']
¶ 类型: 布尔值 默认值: false 若启用,将允许通过 cookie 认证登录到任意服务器并允许在同步对话框中指定服务器。
注解
请谨慎使用该功能,这将可能导致用户访问到位于:term:HTTP 服务器防火墙后面的 MySQL 服务器。请参阅
$cfg['ArbitraryServerRegexp']
。
-
$cfg['ArbitraryServerRegexp']
¶ 类型: 文本 默认值: ''
:config:选项:$ cfg如果启用了’armabbitraryserver’,请限制允许用户通过匹配术语的主机名:`ip`或mysql服务器到正则表达式来登录的mysql服务器。必须在分隔符中括起正常表达式。
建议设置用于常规表达式的开始和结束符号,以避免部分匹配。
例如:
// Allow connection to three listed servers: $cfg['ArbitraryServerRegexp'] = '/^(server|another|yetdifferent)$/'; // Allow connection to range of IP addresses: $cfg['ArbitraryServerRegexp'] = '@^192\.168\.0\.[0-9]{1,}$@'; // Allow connection to server name ending with -mysql: $cfg['ArbitraryServerRegexp'] = '@^[^:]\-mysql$@';
注解
匹配整个服务器名称时,可以包括端口。MySQL是连接参数的容忍度,因此您可以使用类似的连接字符串,如“Server:3306-MySQL``”。这可以用于在连接到其他服务器时绕过后缀的正则表达式。
-
$cfg['CaptchaMethod']
¶ 类型: 文本 默认值: ''看不见'
有效值有:
5.0.3 新版功能.
-
$cfg['CaptchaApi']
¶ 类型: 文本 默认值: 'https://www.google.com/recaptcha/api.js'
5.1.0 新版功能.
谷歌或兼容的recaptcha v2服务API URL。
-
$cfg['CaptchaCsp']
¶ 类型: 文本 默认值: 'https://apis.google.com https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/ https://ssl.gstatic.com/'
5.1.0 新版功能.
Google或兼容服务Recaptcha V2服务的内容 - 安全策略代码段(嵌入式内容的URL)。
-
$cfg['CaptchaRequestParam']
¶ 类型: 文本 默认值: 'g-recaptcha'`
5.1.0 新版功能.
reCaptcha v2 服务所需要的请求参数。
-
$cfg['CaptchaResponseParam']
¶ 类型: 文本 默认值: 'g-recaptcha-response'
5.1.0 新版功能.
reCaptcha v2 服务用到的响应参数。
-
$cfg['CaptchaLoginPublicKey']
¶ 类型: 文本 默认值: ''
通过reCAPTCHA服务的公钥,可以从https://www.google.com/recaptcha/about/ 的 “管理控制台”中获取。
reCaptcha 将会用于 Cookie 认证方式。
4.1.0 新版功能.
-
$cfg['CaptchaLoginPrivateKey']
¶ 类型: 文本 默认值: ''
可以从 https://www.google.com/recaptcha/about/ 上的“管理控制台”获取的 reCaptcha 服务的私钥。
reCaptcha 将会用于 Cookie 认证方式。
4.1.0 新版功能.
-
$cfg['CaptchaSiteVerifyURL']
¶ 类型: 文本 默认值: ''
reCaptcha 服务执行站点验证操作的 URL。
reCaptcha 将会用于 Cookie 认证方式。
5.1.0 新版功能.
主面板¶
-
$cfg['ShowStats']
¶ 类型: 布尔值 默认值: true 定义是否显示有关数据库和表的空间使用情况和统计信息。请注意,统计信息至少需要MySQL 3.23.3,并且目前MySQL不会为Berkeley DB表返回此类信息。
-
$cfg['ShowServerInfo']
¶ 类型: 布尔值|文本 默认值: true 定义是否在主页上显示详细的服务器信息。可能的值为:
true
显示所有服务器信息false
隐藏服务器信息'database-server'
仅显示数据库服务器信息'web-server'
仅显示web服务器信息
您还可以使用
$cfg['Servers'][$i]['verbose']
隐藏更多信息。在 6.0.0 版更改: 添加了
'database-server'
和'web-server'
选项。
-
$cfg['ShowPhpInfo']
¶ 类型: 布尔值 默认值: false 设置是否在主 (右侧) 框架中显示 PHP 信息。
请注意若要限制脚本使用
phpinfo()
函数,你必须在php.ini
中设置:disable_functions = phpinfo()
警告
启用 phpinfo 页会泄露很多关于服务器设置的信息,不推荐在共享安装中这样做。
这也可能会使得针对您安装实例的远程攻击更容易,所以请仅在需要时启用它。
-
$cfg['ShowChgPassword']
¶ 类型: 布尔值 默认值: true 设置是否在主 (右侧) 框架中显示 :guilabel`修改密码` 链接。此设置不检查直接输入的 MySQL 命令。
注意:启用 修改密码 链接不影响所配置的认证方式,因为密码以硬编码形式保存在配置文件中,且终端用户不允许修改它们的密码。
-
$cfg['ShowCreateDb']
¶ 类型: 布尔值 默认值: true 设置是否在主 (右侧) 框架中显示创建数据库表单。此设置不检查直接输入的 MySQL 命令。
-
$cfg['ShowGitRevision']
¶ 类型: 布尔值 默认值: true 定义是否在主面板上显示有关当前Git版本(如果适用)的信息。
-
$cfg['MysqlMinVersion']
¶ 类型: 数组 定义支持的最低 MySQL 版本。默认值由 phpMyAdmin 团队选择;然而,Plesk 控制面板的开发人员要求此指令以简化与较旧的 MySQL 服务器(大多数 phpMyAdmin 功能在其中工作)的集成。
数据库结构¶
-
$cfg['ShowDbStructureCharset']
¶ 类型: 布尔值 默认值: false 定义是否在数据库结构视图中显示所有表格的字符集。
-
$cfg['ShowDbStructureComment']
¶ 类型: 布尔值 默认值: false 定义是否在表结构视图中显示所有表格的注释。
-
$cfg['ShowDbStructureCreation']
¶ 类型: 布尔值 默认值: false 定义数据库结构页(数据表列表)是否有一个 “创建 “列,显示每个表的创建时间。
-
$cfg['ShowDbStructureLastUpdate']
¶ 类型: 布尔值 默认值: false 定义数据库结构页(数据表列表)是否有一个 “最后更新 “字段,显示每个表最后更新的时间。
-
$cfg['ShowDbStructureLastCheck']
¶ 类型: 布尔值 默认值: false 定义数据库结构页(数据表列表)是否有一个 “最后检查” 列,显示每个表最后检查的时间。
-
$cfg['HideStructureActions']
¶ 类型: 布尔值 默认值: true 是否将对表结构的相关操作隐藏在“ 更多 ”下拉菜单中。
-
$cfg['ShowColumnComments']
¶ 类型: 布尔值 默认值: true 定义是否在表结构视图中将列注释显示为列。
浏览模式¶
-
$cfg['ActionLinksMode']
¶ 类型: 文本 默认值: 'both'
如果设置为
icons
,将显示图标而不是数据库和表属性链接的文本(如:Browse,Select,Insert……)。如果需要图标和文本,可以设置为'both'
。当设置为text
时,将只显示文本。
-
$cfg['RowActionType']
¶ 类型: 文本 默认值: 'both'
是否在表行操作段中显示图标或文本或同时显示图标和文本。值可以是
'icons'``(图标)、
’text’``(文本)或 ``’both’``(两者)之一。
-
$cfg['ShowAll']
¶ 类型: 布尔值 默认值: false 定义是否在所有情况下都应在浏览模式下向用户展示“显示全部”按钮。默认情况下,它仅在小表(少于 500 行)上显示,以避免在获取太多行时出现性能问题。
-
$cfg['MaxRows']
¶ 类型: 整数 默认值: 25 浏览一个结果集时一次显示的最多行数。如果结果集超过此值,将会显示“ 上一页 ” 和“ 下一页 ”的链接。可能的取值:25、50、100、250及500。
-
$cfg['Order']
¶ 类型: 文本 默认值: 'SMART'
定义列是按升序(
ASC
)、降序(DESC
)还是“智能”(SMART
)顺序显示——即,TIME、DATE、DATETIME 和 TIMESTAMP 类型列的降序排列,否则默认为升序排列。在 3.4.0 版更改: 从 phpMyAdmin 3.4.0 开始,默认值为
'SMART'
。
-
$cfg['DisplayBinaryAsHex']
¶ 类型: 布尔值 默认值: true 定义“将二进制内容显示为十六进制”浏览选项是否默认勾选。
3.3.0 新版功能.
4.3.0 版后已移除: 此设置已删除。
-
$cfg['GridEditing']
¶ 类型: 文本 默认值: 'double-click'
定义哪个动作(
double-click``(双击)或 ``click``(单击))触发网格编辑。可以使用 ``disabled
值停用。
-
$cfg['RelationalDisplay']
¶ 类型: 文本 默认值: 'K'
定义选项 > 关系的初始行为。
K
为默认值,显示键;而``D`` 显示列。
-
$cfg['SaveCellsAtOnce']
¶ 类型: 布尔值 默认值: false 定义是否一次保存所有编辑的单元格以进行网格编辑。
编辑模式¶
-
$cfg['ProtectBinary']
¶ 类型: 布尔值或字符串 默认值: 'blob'
定义在浏览表的内容时,是否保护
BLOB
或BINARY
列不被编辑。有效值为:false
以允许编辑所有列'blob'
以允许编辑所有除了BLOBS
的列'noblob'
to disallow editing of all columns exceptBLOBS
(the opposite of'blob'
);'all'
to disallow editing of allBINARY
orBLOB
columns.
-
$cfg['ShowFunctionFields']
¶ 类型: 布尔值 默认值: true 定义MySQL函数字段最初是否应以编辑/插入模式显示。自2.10版以来,用户可以从界面上切换这一设置。
-
$cfg['ShowFieldTypesInDataEditView']
¶ 类型: 布尔值 默认值: true 定义类型字段最初是否应以编辑/插入模式显示。用户可以在界面上切换这一设置。
-
$cfg['InsertRows']
¶ 类型: 整数 默认值: 2 定义了在插入页面上输入的默认行数。用户可以从该页面的底部手动更改,以添加或删除空白行。
-
$cfg['ForeignKeyMaxLimit']
¶ 类型: 整数 默认值: 100 如果外键集合中的项目少于此数,那么就会出现一个外键的下拉框,其样式由
$cfg['ForeignKeyDropdownOrder']
设置描述。
-
$cfg['ForeignKeyDropdownOrder']
¶ 类型: 数组 默认值: array(‘content-id’, ‘id-content’) For the foreign key drop-down fields, there are several methods of display, offering both the key and value data. The contents of the array should be one or both of the following strings:
content-id
,id-content
.
导入与导出设置¶
-
$cfg['ZipDump']
¶ 类型: 布尔值 默认值: true
-
$cfg['GZipDump']
¶ 类型: 布尔值 默认值: true
-
$cfg['BZipDump']
¶ 类型: 布尔值 默认值: true 设置在创建转储文件时是否允许使用 zip/GZip/BZip2 压缩
-
$cfg['CompressOnFly']
¶ 类型: 布尔值 默认值: true 定义是否允许对GZip/BZip2压缩输出进行即时压缩。这不影响较小的转储,并允许用户创建更大的转储,否则由于php的内存限制,将无法装入内存。产生的文件包含更多的GZip/BZip2头文件,但所有正常的程序都能正确处理这个问题。
-
$cfg['Export']
¶ 类型: 数组 默认值: array(…) In this array are defined default parameters for export, names of items are similar to texts seen on export page, so you can easily identify what they mean.
-
$cfg['Export']['format']
¶ 类型: 文本 默认值: 'sql'
默认导出格式。
-
$cfg['Export']['method']
¶ 类型: 文本 默认值: 'quick'
定义导出表单加载时的显示方式。有效值是:
quick
——仅显示最小数目的配置项custom
——显示所有可用的配置项custom-no-form
same ascustom
but does not display the option of using quick export
-
$cfg['Export']['compression']
¶ 类型: 文本 默认值: 'none'
默认导出压缩方法。可能的值为
'none'
、'zip'
或'gzip'
。
-
$cfg['Export']['charset']
¶ 类型: 文本 默认值: ''
定义生成输出的字符集。默认情况下,假设为UTF-8,则不进行字符集转换。
-
$cfg['Export']['file_template_table']
¶ 类型: 文本 默认值: '@TABLE@'
表格导出的默认文件名模板。
-
$cfg['Export']['file_template_database']
¶ 类型: 文本 默认值: '@DATABASE@'
数据库或模板导出的默认文件名。
-
$cfg['Export']['file_template_server']
¶ 类型: 文本 默认值: '@SERVER@'
服务器导出的默认文件名模板。
-
$cfg['Export']['remove_definer_from_definitions']
¶ 类型: 布尔值 默认值: false 从事件、视图和例程定义中删除 DEFINER 语句。
5.2.0 新版功能.
-
$cfg['Import']
¶ 类型: 数组 默认值: array(…) 在这个数组中,定义了导入的默认参数,项目的名称与导入页面上的文本相似,所以你可以很容易地识别它们的含义。
-
$cfg['Import']['charset']
¶ 类型: 文本 默认值: ''
定义导出的字符集,默认假定为 UTF-8,不进行转换。
-
$cfg['Schema']
¶ 类型: 数组 默认值: array(…)
-
$cfg['Schema']['format']
¶ 类型: 文本 默认值: 'pdf'
定义模式输出的默认格式。可能的值是
'pdf'
、'eps'
、'dia'
或'svg'
。
标签页显示设置¶
-
$cfg['TabsMode']
¶ 类型: 文本 默认值: 'both'
Defines whether the menu tabs contain
'icons'
,'text'
or'both'
.
-
$cfg['PropertiesNumColumns']
¶ 类型: 整数 默认值: 1 将利用多少列来显示数据库属性视图上的表?当设置为大于1的值时,数据库的类型将被省略以获得更多的显示空间。
-
$cfg['DefaultTabServer']
¶ 类型: 文本 默认值: 'welcome'
定义默认情况下在服务器视图上显示的选项卡。可能的值是以下的本地化等效值:
welcome
(recommended for multi-user setups)databases
,status
variables
privileges
-
$cfg['DefaultTabDatabase']
¶ 类型: 文本 默认值: 'structure'
定义数据库视图中默认显示的选项卡。可能的值是以下的本地化等效值:
structure
sql
search
operations
-
$cfg['DefaultTabTable']
¶ 类型: 文本 默认值: 'browse'
定义默认情况下在表视图上显示的选项卡。可能的值是以下的本地化等效值:
structure
sql
search
insert
browse
PDF 选项¶
-
$cfg['PDFPageSizes']
¶ 类型: 数组 默认值: array('A3', 'A4', 'A5', 'letter', 'legal')
用于创建PDF页面的可能纸张尺寸数组。
应该不需要改变它。
-
$cfg['PDFDefaultPageSize']
¶ 类型: 文本 默认值: 'A4'
创建PDF页面所使用的默认页面尺寸。所有有效的值在
$cfg['PDFPageSizes']
中列出。
语言¶
-
$cfg['DefaultLang']
¶ 类型: 文本 默认值: 'en'
定义了浏览器及用户未定义情况下的默认语言。locale/code/LC_MESSAGES/phpmyadmin.mo 中应有相应的语言文件。
-
$cfg['DefaultConnectionCollation']
¶ 类型: 文本 默认值: 'utf8mb4_general_ci'
如果用户没有另行定义,则定义默认的连接整理方式。参见 MySQL文档中的字符集 ,以获得可能的值列表。
-
$cfg['Lang']
¶ 类型: 文本 默认值: 暂未设置 强制使用的语言。locale/code/LC_MESSAGES/phpmyadmin.mo 中应有相应的语言文件。
-
$cfg['FilterLanguages']
¶ 类型: 文本 默认值: ''
通过正则表达式限制可用语言列表。例如只允许使用简体中文和英语,可以设置为
'^(zh_CN|en)'
。
-
$cfg['RecodingEngine']
¶ 类型: 文本 默认值: 'auto'
你可以在这里选择使用哪个函数来转换字符集。可选值有:
'auto'
- automatically use available one (first is tested iconv, then mbstring)'iconv'
- use iconv or libiconv functions'mb'
- use mbstring extension'none'
- disable encoding conversion
启用编码转换后将会在导出和导入页面显示一个用于选择导出文件字符集的下拉菜单。其默认值来自 $cfg[‘Export’][‘charset’] 和 $cfg[‘Import’][‘charset’] 。
在 6.0.0 版更改: Support for the Recode extension has been removed. The
'recode'
value is ignored and the default value ('auto'
) is used instead.
-
$cfg['IconvExtraParams']
¶ 类型: 文本 默认值: '//TRANSLIT'
Specify some parameters for iconv used in charset conversion. See iconv documentation for details. By default
//TRANSLIT
is used, so that invalid characters will be transliterated.
-
$cfg['AvailableCharsets']
¶ 类型: 数组 默认值: array(…) Available character sets for MySQL conversion. You can add your own (any of supported by mbstring/iconv) or remove these which you don’t use. Character sets will be shown in same order as here listed, so if you frequently use some of these move them to the top.
Web 服务器设置¶
-
$cfg['OBGzip']
¶ 类型: string/boolean 默认值: 'auto'
设为 true/false 以启用/禁用。当设为 ‘auto’ (字符串) 时,phpMyAdmin 将尝试启用输出缓冲并在浏览器对缓冲支持有问题时自动禁用。已知具有特定补丁的 IE6 会在启用缓冲时导致数据损坏。
-
$cfg['TrustedProxies']
¶ 类型: 数组 默认值: array() Lists proxies and HTTP headers which are trusted for
$cfg['Servers'][$i]['AllowDeny']['order']
. This list is by default empty, you need to fill in some trusted proxy servers if you want to use rules for IP addresses behind proxy.下面的例子指定了 phpMyAdmin 应该信任从代理 1.2.3.4 发来的 HTTP_X_FORWARDED_FOR(
X-Forwarded-For
)头:$cfg['TrustedProxies'] = ['1.2.3.4' => 'HTTP_X_FORWARDED_FOR'];
The
$cfg['Servers'][$i]['AllowDeny']['rules']
directive uses the client’s IP address as usual.
-
$cfg['GD2Available']
¶ 类型: 文本 默认值: 'auto'
指定 GD >= 2 版本是否可用。它将被用于 MIME 类型转换。可能的值包括:
- auto——自动检测
- 是 (yes) - GD 2 函数库可以使用
- 否 (no) - GD 2 函数库不可用
-
$cfg['CheckConfigurationPermissions']
¶ 类型: 布尔值 默认值: true 通常情况下我们会检查配置文件确保不是所有人都能修改它。然而 phpMyAdmin 可能被安装在非 Windows 服务器的 NTFS 文件系统中,在这种情况下看起来权限是错误的但实际上我们无法检测。此时系统管理员应将该指令设为
false
。
-
$cfg['LinkLengthLimit']
¶ 类型: 整数 默认值: 1000 Limit for length of URL in links. When length would be above this limit, it is replaced by form with button. This is required as some web servers (IIS) have problems with long URL .
-
$cfg['CSPAllow']
¶ 类型: 文本 默认值: ''
额外的字符串,包括在内容安全策略(CSP)标头中允许的脚本和图像来源。
This can be useful when you want to include some external JavaScript files in
config.footer.inc.php
orconfig.header.inc.php
, which would be normally not allowed by Content Security Policy.To allow some sites, just list them within the string:
$cfg['CSPAllow'] = 'example.com example.net';
4.0.4 新版功能.
-
$cfg['DisableMultiTableMaintenance']
¶ 类型: 布尔值 默认值: false In the database Structure page, it’s possible to mark some tables then choose an operation like optimizing for many tables. This can slow down a server; therefore, setting this to
true
prevents this kind of multiple maintenance operation.
主题设置¶
请直接修改themes/themename/scss/_variables.scss
,你的修改可能会在下次更新时被覆盖。
自定义设计¶
类型: 布尔值 默认值: true When set to true, hovering over an item in the navigation panel causes that item to be marked (the background is highlighted).
-
$cfg['BrowsePointerEnable']
¶ 类型: 布尔值 默认值: true When set to true, hovering over a row in the Browse page causes that row to be marked (the background is highlighted).
-
$cfg['BrowseMarkerEnable']
¶ 类型: 布尔值 默认值: true When set to true, a data row is marked (the background is highlighted) when the row is selected with the checkbox.
-
$cfg['LimitChars']
¶ 类型: 整数 默认值: 50 Maximum number of characters shown in any non-numeric field on browse view. Can be turned off by a toggle button on the browse page.
-
$cfg['RowActionLinks']
¶ 类型: 文本 默认值: 'left'
Defines the place where table row links (Edit, Copy, Delete) would be put when tables contents are displayed (you may have them displayed at the left side, right side, both sides or nowhere).
-
$cfg['RowActionLinksWithoutUnique']
¶ 类型: 布尔值 默认值: false Defines whether to show row links (Edit, Copy, Delete) and checkboxes for multiple row operations even when the selection does not have a unique key. Using row actions in the absence of a unique key may result in different/more rows being affected since there is no guaranteed way to select the exact row(s).
-
$cfg['RememberSorting']
¶ 类型: 布尔值 默认值: true If enabled, remember the sorting of each table when browsing them.
-
$cfg['TablePrimaryKeyOrder']
¶ 类型: 文本 默认值: 'NONE'
This defines the default sort order for the tables, having a primary key, when there is no sort order defines externally. Acceptable values : [‘NONE’, ‘ASC’, ‘DESC’]
-
$cfg['ShowBrowseComments']
¶ 类型: 布尔值 默认值: true
-
$cfg['ShowPropertyComments']
¶ 类型: 布尔值 默认值: true By setting the corresponding variable to
true
you can enable the display of column comments in Browse or Property display. In browse mode, the comments are shown inside the header. In property mode, comments are displayed using a CSS-formatted dashed-line below the name of the column. The comment is shown as a tool-tip for that column.
-
$cfg['FirstDayOfCalendar']
¶ 类型: 整数 默认值: 0 This will define the first day of week in the calendar. The number can be set from 0 to 6, which represents the seven days of the week, Sunday to Saturday respectively. This value can also be configured by the user in Settings -> Features -> General -> First day of calendar field.
文本字段¶
-
$cfg['CharEditing']
¶ 类型: 文本 默认值: 'input'
设置编辑 CHAR 和 VARCHAR 类型字段时应使用何种控件。应用于数据编辑和结构编辑的默认值。可选值有:
- 输入框 (input) - 允许限制输入字数使其不超过 MySQL 字段限制,但无法换行
- 文本框 (textarea) - 可以换行,但没有字数限制
-
$cfg['MinSizeForInputField']
¶ 类型: 整数 默认值: 4 定义了当编辑 CHAR 和 VARCHAR 字段时所使用输入框的最小大小。
-
$cfg['MaxSizeForInputField']
¶ 类型: 整数 默认值: 60 定义了当编辑 CHAR 和 VARCHAR 字段时所使用输入框的最大大小。
-
$cfg['TextareaCols']
¶ 类型: 整数 默认值: 40
-
$cfg['TextareaRows']
¶ 类型: 整数 默认值: 15
-
$cfg['CharTextareaCols']
¶ 类型: 整数 默认值: 40
-
$cfg['CharTextareaRows']
¶ 类型: 整数 默认值: 7 Number of columns and rows for the textareas. This value will be emphasized (*2) for SQL query textareas and (*1.25) for SQL textareas inside the query window.
The Char* values are used for CHAR and VARCHAR editing (if configured via
$cfg['CharEditing']
).在 5.0.0 版更改: 默认值从2变化为7。
-
$cfg['LongtextDoubleTextarea']
¶ 类型: 布尔值 默认值: true Defines whether textarea for LONGTEXT columns should have double size.
-
$cfg['TextareaAutoSelect']
¶ 类型: 布尔值 默认值: false Defines if the whole textarea of the query box will be selected on click.
-
$cfg['EnableAutocompleteForTablesAndColumns']
¶ 类型: 布尔值 默认值: true 是否在任何SQL查询框中启用表和字段名的自动完成功能。
SQL 查询框设定¶
-
$cfg['SQLQuery']['Edit']
¶ 类型: 布尔值 默认值: true 是否显示编辑链接以改变任何SQL查询框中的查询。
-
$cfg['SQLQuery']['Explain']
¶ 类型: 布尔值 默认值: true 是否在任何SQL查询框中显示一个解释SELECT查询的链接。
-
$cfg['SQLQuery']['ShowAsPHP']
¶ 类型: 布尔值 默认值: true 是否在任何SQL查询框中显示一个用PHP代码包装查询的链接。
-
$cfg['SQLQuery']['Refresh']
¶ 类型: 布尔值 默认值: true 是否在任何SQL查询框中显示一个刷新查询的链接。
Web 服务器上传/保存/导入目录¶
If PHP is running in safe mode, all directories must be owned by the same user as the owner of the phpMyAdmin scripts.
If the directory where phpMyAdmin is installed is subject to an
open_basedir
restriction, you need to create a temporary directory in some
directory accessible by the PHP interpreter.
For security reasons, all directories should be outside the tree published by
webserver. If you cannot avoid having this directory published by webserver,
limit access to it either by web server configuration (for example using
.htaccess or web.config files) or place at least an empty index.html
file there, so that directory listing is not possible. However as long as the
directory is accessible by web server, an attacker can guess filenames to download
the files.
-
$cfg['UploadDir']
¶ 类型: 文本 默认值: ''
The name of the directory where SQL files have been uploaded by other means than phpMyAdmin (for example, FTP). Those files are available under a drop-down box when you click the database or table name, then the Import tab.
If you want different directory for each user, %u will be replaced with username.
Please note that the file names must have the suffix “.sql” (or “.sql.bz2” or “.sql.gz” if support for compressed formats is enabled).
This feature is useful when your file is too big to be uploaded via HTTP, or when file uploads are disabled in PHP.
警告
Please see top of this chapter (Web 服务器上传/保存/导入目录) for instructions how to setup this directory and how to make its usage secure.
参见
See 1.16 我无法上传大转储文件(内存、HTTP或超时问题)。 for alternatives.
-
$cfg['SaveDir']
¶ 类型: 文本 默认值: ''
服务器上用来保存导出文件的文件夹。
If you want a different directory for each user, %u will be replaced with the username.
Please note that the directory must exist and has to be writable for the user running webserver.
警告
Please see top of this chapter (Web 服务器上传/保存/导入目录) for instructions how to setup this directory and how to make its usage secure.
-
$cfg['TempDir']
¶ 类型: 文本 默认值: './tmp/'
The name of the directory where temporary files can be stored. It is used for several purposes, currently:
- The templates cache which speeds up page loading.
- ESRI Shapefiles import, see 6.30 导入:如何导入 ESRI Shapefiles?.
- To work around limitations of
open_basedir
for uploaded files, see 1.11 从“导入”选项卡上载文件时,我收到“打开_basedir 限制”。.
This directory should have as strict permissions as possible as the only user required to access this directory is the one who runs the webserver. If you have root privileges, simply make this user owner of this directory and make it accessible only by it:
chown www-data:www-data tmp chmod 700 tmp
If you cannot change owner of the directory, you can achieve a similar setup using ACL:
chmod 700 tmp setfacl -m "g:www-data:rwx" tmp setfacl -d -m "g:www-data:rwx" tmp
If neither of above works for you, you can still make the directory chmod 777, but it might impose risk of other users on system reading and writing data in this directory.
警告
Please see top of this chapter (Web 服务器上传/保存/导入目录) for instructions how to setup this directory and how to make its usage secure.
显示设置¶
-
$cfg['RepeatCells']
¶ 类型: 整数 默认值: 100 Repeat the headers every X cells, or 0 to deactivate.
-
$cfg['EditInWindow']
¶ 类型: 布尔值 默认值: true 4.3.0 版后已移除: 此设置已删除。
-
$cfg['QueryWindowWidth']
¶ 类型: 整数 默认值: 550 4.3.0 版后已移除: 此设置已删除。
-
$cfg['QueryWindowHeight']
¶ 类型: 整数 默认值: 310 4.3.0 版后已移除: 此设置已删除。
-
$cfg['QueryHistoryDB']
¶ 类型: 布尔值 默认值: false
-
$cfg['QueryWindowDefTab']
¶ 类型: 文本 默认值: 'sql'
4.3.0 版后已移除: 此设置已删除。
-
$cfg['QueryHistoryMax']
¶ 类型: 整数 默认值: 25 If
$cfg['QueryHistoryDB']
is set totrue
, 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 totrue
you can specify the amount of saved history items using$cfg['QueryHistoryMax']
.
类型: 布尔值 默认值: true 6.0.0 新版功能.
允许用户创建可供所有其他用户使用的书签
-
$cfg['MaxExactCount']
¶ 类型: 整数 默认值: 50000 For InnoDB tables, determines for how large tables phpMyAdmin should get the exact row count using
SELECT COUNT
. If the approximate row count as returned bySHOW TABLE STATUS
is smaller than this value,SELECT COUNT
will be used, otherwise the approximate count will be used.在 4.8.0 版更改: 由于性能原因,默认值降低至50000。
在 4.2.6 版更改: 默认值已改变为500000。
-
$cfg['MaxExactCountViews']
¶ 类型: 整数 默认值: 0 For VIEWs, since obtaining the exact count could have an impact on performance, this value is the maximum to be displayed, using a
SELECT COUNT ... LIMIT
. Setting this to 0 bypasses any row counting.
-
$cfg['NaturalOrder']
¶ 类型: 布尔值 默认值: true Sorts database and table names according to natural order (for example, t1, t2, t10). Currently implemented in the navigation panel and in Database view, for the table list.
-
$cfg['InitialSlidersState']
¶ 类型: 文本 默认值: 'closed'
If set to
'closed'
, the visual sliders are initially in a closed state. A value of'open'
does the reverse. To completely disable all visual sliders, use'disabled'
.
-
$cfg['UserprefsDisallow']
¶ 类型: 数组 默认值: array() Contains names of configuration options (keys in
$cfg
array) that users can’t set through user preferences. For possible values, refer to classes undersrc/Config/Forms/User/
.
-
$cfg['UserprefsDeveloperTab']
¶ 类型: 布尔值 默认值: false 3.4.0 新版功能.
Activates in the user preferences a tab containing options for developers of phpMyAdmin.
页面标题¶
The page title displayed by your browser’s window or tab title bar can be customized. You can use 6.27 我可以使用哪些格式字符串?. The following four options allow customizing various parts of the phpMyAdmin interface. Note that the login page title cannot be changed.
-
$cfg['TitleTable']
¶ 类型: 文本 默认值: '@HTTP_HOST@ / @VSERVER@ / @DATABASE@ / @TABLE@ | @PHPMYADMIN@'
-
$cfg['TitleDatabase']
¶ 类型: 文本 默认值: '@HTTP_HOST@ / @VSERVER@ / @DATABASE@ | @PHPMYADMIN@'
-
$cfg['TitleServer']
¶ 类型: 文本 默认值: '@HTTP_HOST@ / @VSERVER@ | @PHPMYADMIN@'
-
$cfg['TitleDefault']
¶ 类型: 文本 默认值: '@HTTP_HOST@ | @PHPMYADMIN@'
主题管理器设置¶
-
$cfg['ThemeManager']
¶ 类型: 布尔值 默认值: true Enables user-selectable themes. See 2.7 如何创建和使用主题?.
-
$cfg['ThemeDefault']
¶ 类型: 文本 默认值: 'pmahomme'
The default theme (a subdirectory under
./public/themes/
).
-
$cfg['ThemePerServer']
¶ 类型: 布尔值 默认值: false 是否允许在每个服务器上使用不同主题。
-
$cfg['FontSize']
¶ 类型: 文本 默认值: ‘82%’ 5.0.0 版后已移除: This setting was removed as the browser is more efficient, thus no need of this option.
使用的字体大小,应用于 CSS。
默认查询¶
-
$cfg['DefaultQueryTable']
¶ 类型: 文本 默认值: 'SELECT * FROM @TABLE@ WHERE 1'
-
$cfg['DefaultQueryDatabase']
¶ 类型: 文本 默认值: ''
在用户没有指定任何查询时,查询框显示的默认查询。你可以参考 6.27 我可以使用哪些格式字符串?。
MySQL 设置¶
-
$cfg['DefaultFunctions']
¶ 类型: 数组 默认值: array('FUNC_CHAR' => '', 'FUNC_DATE' => '', 'FUNC_NUMBER' => '', 'FUNC_SPATIAL' => 'GeomFromText', 'FUNC_UUID' => 'UUID', 'first_timestamp' => 'NOW')
Functions selected by default when inserting/changing row, Functions are defined for meta types as (
FUNC_NUMBER
,FUNC_DATE
,FUNC_CHAR
,FUNC_SPATIAL
,FUNC_UUID
) and forfirst_timestamp
, which is used for first timestamp column in table.示例配置
$cfg['DefaultFunctions'] = [ 'FUNC_CHAR' => '', 'FUNC_DATE' => '', 'FUNC_NUMBER' => '', 'FUNC_SPATIAL' => 'ST_GeomFromText', 'FUNC_UUID' => 'UUID', 'first_timestamp' => 'UTC_TIMESTAMP', ];
默认变换选项¶
-
$cfg['DefaultTransformations']
¶ 类型: 数组 默认值: An array with below listed key-values
-
$cfg['DefaultTransformations']['Substring']
¶ 类型: 数组 默认值: array(0, ‘all’, ‘…’)
-
$cfg['DefaultTransformations']['Bool2Text']
¶ 类型: 数组 默认值: array(‘T’, ‘F’)
-
$cfg['DefaultTransformations']['External']
¶ 类型: 数组 默认值: array(0, ‘-f /dev/null -i -wrap -q’, 1, 1)
-
$cfg['DefaultTransformations']['PreApPend']
¶ 类型: 数组 默认值: array(‘’, ‘’)
-
$cfg['DefaultTransformations']['Hex']
¶ 类型: 数组 默认值: array(‘2’)
-
$cfg['DefaultTransformations']['DateFormat']
¶ 类型: 数组 默认值: array(0, ‘’, ‘local’)
-
$cfg['DefaultTransformations']['Inline']
¶ 类型: 数组 默认值: array(‘100’, 100)
-
$cfg['DefaultTransformations']['TextImageLink']
¶ 类型: 数组 默认值: array(‘’, 100, 50)
-
$cfg['DefaultTransformations']['TextLink']
¶ 类型: 数组 默认值: array(‘’, ‘’, ‘’)
控制台设置¶
注解
这些配置是最需要用户修改的。
-
$cfg['Console']['StartHistory']
¶ 类型: 布尔值 默认值: false 在开始时显示查询历史
-
$cfg['Console']['AlwaysExpand']
¶ 类型: 布尔值 默认值: false 总是扩展查询消息
-
$cfg['Console']['CurrentQuery']
¶ 类型: 布尔值 默认值: true 显示当前浏览查询
-
$cfg['Console']['EnterExecutes']
¶ 类型: 布尔值 默认值: false 使用Enter执行查询,使用Shift+Enter插入新行
-
$cfg['Console']['DarkTheme']
¶ 类型: 布尔值 默认值: false 切换到黑色主题
-
$cfg['Console']['Mode']
¶ 类型: 文本 默认值: ‘info’ 控制台模式
-
$cfg['Console']['Height']
¶ 类型: 整数 默认值: 92 控制台高度
开发¶
警告
这些设置可能会对性能或安全性产生很大影响。
-
$cfg['environment']
¶ 类型: 文本 默认值: 'production'
设置工作环境。
仅在使用 phpMyAdmin 开发时才需要修改此选项。
development
模式可能会在一些地方显示调试信息。可用的值为
'production'
或'development'
。
-
$cfg['DBG']
¶ 类型: 数组 默认值: []
-
$cfg['DBG']['sql']
¶ 类型: 布尔值 默认值: false Enable logging queries and execution times to be displayed in the console’s Debug SQL tab.
-
$cfg['DBG']['sqllog']
¶ 类型: 布尔值 默认值: false Enable logging of queries and execution times to the syslog. Requires
$cfg['DBG']['sql']
to be enabled.
-
$cfg['DBG']['demo']
¶ 类型: 布尔值 默认值: false Enable to let server present itself as demo server. This is used for phpMyAdmin demo server.
目前改变了如下行为:
- 这是主页的欢迎消息。
- 这里是有关演示服务器和 Git 修订版的信息。
- 在已有配置的情况下,安装脚本也会启用。
- 此安装不会尝试连接至 MySQL 服务器。
-
$cfg['DBG']['simple2fa']
¶ 类型: 布尔值 默认值: false 可以使用 简单的双因素身份验证 来测试双因素身份验证。
示例¶
查看这些 phpMyAdmin 的典型安装配置片断。
基本示例¶
配置文件的例子,可以复制到 :file:`config.inc.php`来获得一些核心的配置布局;它作为 :file:`config.sample.inc.php`与phpMyAdmin一起分发。请注意,它不包含所有的配置选项,只包含最经常使用的选项。
<?php
/**
* phpMyAdmin sample configuration, you can use it as base for
* manual configuration. For easier setup you can use setup/
*
* All directives are explained in documentation in the doc/ folder
* or at <https://docs.phpmyadmin.net/>.
*/
declare(strict_types=1);
/**
* This is needed for cookie based authentication to encrypt the cookie.
* Needs to be a 32-bytes long string of random bytes. See FAQ 2.10.
*/
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
/**
* Servers configuration
*/
$i = 0;
/**
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
/**
* phpMyAdmin configuration storage settings.
*/
/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
// $cfg['Servers'][$i]['controlport'] = '';
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';
/* Storage database and tables */
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma__relation';
// $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
// $cfg['Servers'][$i]['history'] = 'pma__history';
// $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
// $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
// $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
// $cfg['Servers'][$i]['recent'] = 'pma__recent';
// $cfg['Servers'][$i]['favorite'] = 'pma__favorite';
// $cfg['Servers'][$i]['users'] = 'pma__users';
// $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
// $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
// $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
// $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
// $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
// $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
/**
* End of servers configuration
*/
/**
* Directories for saving/loading files from server
*/
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
/**
* Whether to display icons or text or both icons and text in table row
* action segment. Value can be either of 'icons', 'text' or 'both'.
* default = 'both'
*/
//$cfg['RowActionType'] = 'icons';
/**
* Defines whether a user should be displayed a "show all (records)"
* button in browse mode or not.
* default = false
*/
//$cfg['ShowAll'] = true;
/**
* Number of rows displayed when browsing a result set. If the result
* set contains more rows, "Previous" and "Next".
* Possible values: 25, 50, 100, 250, 500
* default = 25
*/
//$cfg['MaxRows'] = 50;
/**
* Disallow editing of binary fields
* valid values are:
* false allow editing
* 'blob' allow editing except for BLOB fields
* 'noblob' disallow editing except for BLOB fields
* 'all' disallow editing
* default = 'blob'
*/
//$cfg['ProtectBinary'] = false;
/**
* Default language to use, if not browser-defined or user-defined
* (you find all languages in the locale folder)
* uncomment the desired line:
* default = 'en'
*/
//$cfg['DefaultLang'] = 'en';
//$cfg['DefaultLang'] = 'de';
/**
* How many columns should be used for table display of a database?
* (a value larger than 1 results in some information being hidden)
* default = 1
*/
//$cfg['PropertiesNumColumns'] = 2;
/**
* Set to true if you want DB-based query history.If false, this utilizes
* JS-routines to display query history (lost by window close)
*
* This requires configuration storage enabled, see above.
* default = false
*/
//$cfg['QueryHistoryDB'] = true;
/**
* When using DB-based query history, how many entries should be kept?
* default = 25
*/
//$cfg['QueryHistoryMax'] = 100;
/**
* Whether or not to query the user before sending the error report to
* the phpMyAdmin team when a JavaScript error occurs
*
* Available options
* ('ask' | 'always' | 'never')
* default = 'ask'
*/
//$cfg['SendErrorReports'] = 'always';
/**
* 'URLQueryEncryption' defines whether phpMyAdmin will encrypt sensitive data from the URL query string.
* 'URLQueryEncryptionSecretKey' is a 32 bytes long secret key used to encrypt/decrypt the URL query string.
*/
//$cfg['URLQueryEncryption'] = true;
//$cfg['URLQueryEncryptionSecretKey'] = '';
/**
* You can find more configuration options in the documentation
* in the doc/ folder or at <https://docs.phpmyadmin.net/>.
*/
警告
如果控制用户 ‘pma’ 还不存在,不要使用它,也不要使用 ‘pmapass’ 作为密码。
Signon 认证方式示例¶
This example uses examples/signon.php
to demonstrate usage of Signon 认证方式:
<?php
$i = 0;
$i++;
$cfg['Servers'][$i]['auth_type'] = 'signon';
$cfg['Servers'][$i]['SignonSession'] = 'SignonSession';
$cfg['Servers'][$i]['SignonURL'] = 'examples/signon.php';
基于 IP 地址限定的自动登录示例¶
如果你想在本地访问phpMyAdmin时自动登录,而在远程访问时要求输入密码,你可以用下面的代码片段实现:
if ($_SERVER['REMOTE_ADDR'] === '127.0.0.1') {
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'yourpassword';
} else {
$cfg['Servers'][$i]['auth_type'] = 'cookie';
}
注解
基于 IP 地址的过滤器在互联网上不太可靠,请仅针对本地地址使用。
使用多台 MySQL 服务器的例子¶
You can configure any number of servers using $cfg['Servers']
,
following example shows two of them:
<?php
// The string is a hexadecimal representation of a 32-bytes long string of random bytes.
$cfg['blowfish_secret'] = sodium_hex2bin('f16ce59f45714194371b48fe362072dc3b019da7861558cd4ad29e4d6fb13851');
$i = 0;
$i++; // server 1 :
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['verbose'] = 'no1';
$cfg['Servers'][$i]['host'] = 'localhost';
// more options for #1 ...
$i++; // server 2 :
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['verbose'] = 'no2';
$cfg['Servers'][$i]['host'] = 'remote.host.addr';//or ip:'10.9.8.1'
// this server must allow remote clients, e.g., host 10.9.8.%
// not only in mysql.host but also in the startup configuration
// more options for #2 ...
// end of server sections
$cfg['ServerDefault'] = 0; // to choose the server on startup
// further general options ...
使用 SSL 的 Google Cloud SQL¶
To connect to Google Could SQL, you currently need to disable certificate verification. This is caused by the certificate being issued for CN matching your instance name, but you connect to an IP address and PHP tries to match these two. With verification you end up with error message like:
Peer certificate CN=`api-project-851612429544:pmatest' did not match expected CN=`8.8.8.8'
警告
With disabled verification your traffic is encrypted, but you’re open to man in the middle attacks.
To connect phpMyAdmin to Google Cloud SQL using SSL download the client and server certificates and tell phpMyAdmin to use them:
// IP address of your instance
$cfg['Servers'][$i]['host'] = '8.8.8.8';
// Use SSL for connection
$cfg['Servers'][$i]['ssl'] = true;
// Client secret key
$cfg['Servers'][$i]['ssl_key'] = '../client-key.pem';
// Client certificate
$cfg['Servers'][$i]['ssl_cert'] = '../client-cert.pem';
// Server certification authority
$cfg['Servers'][$i]['ssl_ca'] = '../server-ca.pem';
// Disable SSL verification (see above note)
$cfg['Servers'][$i]['ssl_verify'] = false;
Amazon RDS Aurora with SSL¶
To connect phpMyAdmin to an Amazon RDS Aurora MySQL database instance using SSL, download the CA server certificate and tell phpMyAdmin to use it:
// Address of your instance
$cfg['Servers'][$i]['host'] = 'replace-me-cluster-name.cluster-replace-me-id.replace-me-region.rds.amazonaws.com';
// Use SSL for connection
$cfg['Servers'][$i]['ssl'] = true;
// You need to have the region CA file and the authority CA file (2019 edition CA for example) in the PEM bundle for it to work
$cfg['Servers'][$i]['ssl_ca'] = '../rds-combined-ca-bundle.pem';
// Enable SSL verification
$cfg['Servers'][$i]['ssl_verify'] = true;
参见
使用SSL连接到数据库服务器、$cfg['Servers'][$i]['ssl']
、$cfg['Servers'][$i]['ssl_ca']
、$cfg['Servers'][$i]['ssl_verify']
参见
- Current RDS CA bundle for all regions https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem
- The RDS CA (2019 edition) for the region eu-west-3 without the parent CA https://s3.amazonaws.com/rds-downloads/rds-ca-2019-eu-west-3.pem
- Amazon RDS CA 可用文件列表
- Amazon MySQL Aurora 安全指南
- Amazon certificates bundles per region
reCaptcha using hCaptcha¶
$cfg['CaptchaApi'] = 'https://www.hcaptcha.com/1/api.js';
$cfg['CaptchaCsp'] = 'https://hcaptcha.com https://*.hcaptcha.com';
$cfg['CaptchaRequestParam'] = 'h-captcha';
$cfg['CaptchaResponseParam'] = 'h-captcha-response';
$cfg['CaptchaSiteVerifyURL'] = 'https://hcaptcha.com/siteverify';
// This is the secret key from hCaptcha dashboard
$cfg['CaptchaLoginPrivateKey'] = '0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
// This is the site key from hCaptcha dashboard
$cfg['CaptchaLoginPublicKey'] = 'xxx-xxx-xxx-xxx-xxxx';
参见
reCaptcha using Turnstile¶
$cfg['CaptchaMethod'] = 'checkbox';
$cfg['CaptchaApi'] = 'https://challenges.cloudflare.com/turnstile/v0/api.js';
$cfg['CaptchaCsp'] = 'https://challenges.cloudflare.com https://static.cloudflareinsights.com';
$cfg['CaptchaRequestParam'] = 'cf-turnstile';
$cfg['CaptchaResponseParam'] = 'cf-turnstile-response';
$cfg['CaptchaLoginPublicKey'] = '0xxxxxxxxxxxxxxxxxxxxxx';
$cfg['CaptchaLoginPrivateKey'] = '0x4AAAAAAAA_xx_xxxxxxxxxxxxxxxxxxxx';
$cfg['CaptchaSiteVerifyURL'] = 'https://challenges.cloudflare.com/turnstile/v0/siteverify';
reCaptcha using Google reCaptcha v2/v3¶
$cfg['CaptchaLoginPublicKey'] = 'xxxxxxxxxxxxxxxx-xxxxxxxxxxxx';
$cfg['CaptchaLoginPrivateKey'] = 'xxxxxxxxx-xxxxxxxxxxxxxx';
// Remove it if you dot not want the checkbox mode
$cfg['CaptchaMethod'] = 'checkbox';
用户指南¶
配置 phpMyAdmin¶
有许多配置设置可以用来定制界面。这些设置在 设置 中描述。配置有几个层次。
全局设置可以在 config.inc.php
中配置,如 设置 所述。这是配置数据库连接和其他系统范围设置的唯一方法。
在此基础上,有一些用户设置可以持久地存储在 phpMyAdmin配置存储 中,可能通过 零配置 自动配置。 如果 phpMyAdmin配置存储 没有被配置,这些设置将被暂时存储在会话数据中;这些设置只在你注销之前有效。
你也可以保存用户配置,以便进一步使用,可以将它们下载为文件,也可以保存到浏览器的本地存储中。你可以在 设置 标签中找到这两个选项。存储在浏览器本地存储器中的设置将在你登录到 phpMyAdmin 时自动提供加载。
双因素身份验证¶
4.8.0 新版功能.
Since phpMyAdmin 4.8.0 you can configure two-factor authentication to be used when logging in. To use this, you first need to configure the phpMyAdmin配置存储. Once this is done, every user can opt-in for the second authentication factor in the Settings.
When running phpMyAdmin from the Git source repository, the dependencies must be installed manually; the typical way of doing so is with the command:
composer require pragmarx/google2fa-qrcode bacon/bacon-qr-code
Or when using a hardware security key with FIDO U2F:
composer require code-lts/u2f-php-server
认证应用(双重验证)¶
Using an application for authentication is a quite common approach based on HOTP and TOTP. It is based on transmitting a private key from phpMyAdmin to the authentication application and the application is then able to generate one time codes based on this key. The easiest way to enter the key in to the application from phpMyAdmin is through scanning a QR code.
There are dozens of applications available for mobile phones to implement these standards, the most widely used include:
硬件安全密钥(FIDO U2F)¶
Using hardware tokens is considered to be more secure than a software based solution. phpMyAdmin supports FIDO U2F tokens.
There are several manufacturers of these tokens, for example:
简单的双因素身份验证¶
This authentication is included for testing and demonstration purposes only as it really does not provide two-factor authentication, it just asks the user to confirm login by clicking on the button.
It should not be used in the production and is disabled unless
$cfg['DBG']['simple2fa']
is set.
转换¶
注解
要使用转换功能,您需要配置 phpMyAdmin配置存储。
介绍¶
要开启转换功能,你必须设置好 column_info
表以及正确的指令。具体设置请见 设置 一节。
phpMyAdmin has two different types of transformations: browser display transformations, which affect only how the data is shown when browsing through phpMyAdmin; and input transformations, which affect a value prior to being inserted through phpMyAdmin. You can apply different transformations to the contents of each column. Each transformation has options to define how it will affect the stored data.
假设你有一个存有文件名的字段 filename
。正常情况下你只能在 phpMyAdmin 中看到文件名。通过显示转换你可以将它们转换成一个 HTML 链接,你就能直接在 phpMyAdmin 中点击并在浏览器的新窗口中看到这个文件。使用转换选项,你还可以指定要追加/预处理的字符串,或者你希望输出结果的存储格式。
For a general overview of all available transformations and their
options, you can either go to the Change
link for an existing column
or from the dialog to create a new column, in either case there is a link
on that column structure page for “Browser display transformation” and
“Input transformation” which will show more information about each
transformation that is available on your system.
为了更有效地使用转换器,请查阅官方主页上的 链接部分 。
使用方法¶
通过点击一张表的“结构”链接前往表格结构页面。点击“修改”(或修改图标)后你就能看到在最下方出现五个与转换相关的表单项。它们分别叫 媒体类型、’浏览器转换’ 和 ‘转换选项’ 。
- 字段 ‘Media type’ 是一个下拉框。选择与字段内容一致的 Media type 类型。请注意如果没有选择任何 Media type 类型转换功能是不起作用的。
- The field ‘Browser display transformation’ is a drop-down field. You can choose from a hopefully growing amount of pre-defined transformations. See below for information on how to build your own transformation. There are global transformations and mimetype-bound transformations. Global transformations can be used for any mimetype. They will take the mimetype, if necessary, into regard. Mimetype-bound transformations usually only operate on a certain mimetype. There are transformations which operate on the main mimetype (like ‘image’), which will most likely take the subtype into regard, and those who only operate on a specific subtype (like ‘image/jpeg’). You can use transformations on mimetypes for which the function was not defined for. There is no security check for you selected the right transformation, so take care of what the output will be like.
- The field ‘Browser display transformation options’ is a free-type textfield. You have
to enter transform-function specific options here. Usually the
transforms can operate with default options, but it is generally a
good idea to look up the overview to see which options are necessary.
Much like the ENUM/SET-Fields, you have to split up several options
using the format ‘a’,’b’,’c’,…(NOTE THE MISSING BLANKS). This is
because internally the options will be parsed as an array, leaving the
first value the first element in the array, and so forth. If you want
to specify a MIME character set you can define it in the
transformation_options. You have to put that outside of the pre-
defined options of the specific mime-transform, as the last value of
the set. Use the format “’; charset=XXX’”. If you use a transform, for
which you can specify 2 options and you want to append a character
set, enter “‘first parameter’,’second parameter’,’charset=us-ascii’”.
You can, however use the defaults for the parameters: “’’,’’,’charset
=us-ascii’”. The default options can be configured using
$cfg['DefaultTransformations']
. - ‘Input transformation’ is another drop-down menu that corresponds exactly with the instructions above for “Browser display transformation” except these these affect the data before insertion in to the database. These are most commonly used to either provide a specialized editor (for example, using the phpMyAdmin SQL editor interface) or selector (such as for uploading an image). It’s also possible to manipulate the data such as converting an IPv4 address to binary or parsing it through a regular expression.
- Finally, ‘Input transformation options’ is the equivalent of the “Browser display transformation options” section above and is where optional and required parameters are entered.
文件结构¶
All specific transformations for mimetypes are defined through class
files in the directory src/Plugins/Transformations/
. Each of
them extends a certain transformation abstract class declared in
src/Plugins/Transformations/Abs
.
它们存储于文件中,方便自定义和添加新的或自定义转换器。
因为用户不能输入他们的类型,这将保证转换可以正常工作。但这不能避免设置一个转换函数无法处理的类型的问题。
There is a file called src/Plugins/Transformations.php
that provides some
basic functions which can be included by any other transform function.
The file name convention is [Mimetype]_[Subtype]_[Transformation
Name].php
, while the abstract class that it extends has the
name [Transformation Name]TransformationsPlugin
. All of the
methods that have to be implemented by a transformations plug-in are:
- getMIMEType() and getMIMESubtype() in the main class;
- getName(), getInfo() and applyTransformation() in the abstract class it extends.
The getMIMEType(), getMIMESubtype() and getName() methods return the name of the MIME type, MIME Subtype and transformation accordingly. getInfo() returns the transformation’s description and possible options it may receive and applyTransformation() is the method that does the actual work of the transformation plug-in.
Please see the src/Plugins/Transformations/TEMPLATE
and
src/Plugins/Transformations/TEMPLATE_ABSTRACT
files for adding
your own transformation plug-in. You can also generate a new
transformation plug-in (with or without the abstract transformation
class), by using
scripts/transformations_generator_plugin.sh
or
scripts/transformations_generator_main_class.sh
.
applyTransformation()
函数将被传入三个参数:
- $buffer - 包含字段中的文字,也是你将要转换的内容。
- $options - 以数组形式保存的用户输入的转换选项。
- $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 Media type of the column (i.e. ‘text/plain’, ‘image/jpeg’ etc.)
书签¶
注解
为了使用书签功能,你需要配置 phpMyAdmin配置存储 。
存储书签¶
任何被执行的查询都可以在显示结果的页面上被标记为一个书签。你会发现一个标有 将此查询标记为书签 的按钮,就在页面的最后。一旦你存储了一个书签,该查询就被链接到数据库中。现在你可以在每个页面上访问一个书签下拉框,该数据库的查询框出现在该页面上。
在书签中使用变量¶
Inside a query, you can also add placeholders for variables.
This is done by inserting into the query SQL comments between /*
and
*/
. The special string [VARIABLE{variable-number}]
is used inside the comments.
Be aware that the whole query minus the SQL comments must be
valid by itself, otherwise you won’t be able to store it as a bookmark.
Also, note that the text ‘VARIABLE’ is case-sensitive.
When you execute the bookmark, everything typed into the Variables
input boxes on the query box page will replace the strings /*[VARIABLE{variable-number}]*/
in
your stored query.
Also remember, that everything else inside the /*[VARIABLE{variable-number}]*/
string for
your query will remain the way it is, but will be stripped of the /**/
chars. So you can use:
/*, [VARIABLE1] AS myname */
将展开为
, VARIABLE1 as myname
in your query, where VARIABLE1 is the string you entered in the Variable 1 input box.
现在举一个更复杂的例子。假如你保存了这个查询:
SELECT Name, Address FROM addresses WHERE 1 /* AND Name LIKE '%[VARIABLE1]%' */
假如你输入了“phpMyAdmin”作为变量,完整的查询将会是:
SELECT Name, Address FROM addresses WHERE 1 AND Name LIKE '%phpMyAdmin%'
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.
使用书签浏览表格¶
如果书签的名称与表格相同,它将被用作浏览此表时的查询。
用户管理¶
User management is the process of controlling which users are allowed to connect to the MySQL server and what permissions they have on each database. phpMyAdmin does not handle user management, rather it passes the username and password on to MySQL, which then determines whether a user is permitted to perform a particular action. Within phpMyAdmin, administrators have full control over creating users, viewing and editing privileges for existing users, and removing users.
在 phpMyAdmin 中,用户管理是在主页的 :guilabel`用户账户` 标签下控制的。用户可以被创建、编辑或删除。
创建新用户¶
To create a new user, click the Add user account link near the bottom of the User accounts page (you must be a “superuser”, e.g., user “root”). Use the textboxes and drop-downs to configure the user to your particular needs. You can then select whether to create a database for that user and grant specific global privileges. Once you’ve created the user (by clicking Go), you can define that user’s permissions on a specific database (don’t grant global privileges in that case). In general, users do not need any global privileges (other than USAGE), only permissions for their specific database.
添加已有的用户¶
To edit an existing user, simply click the pencil icon to the right of that user in the User accounts page. You can then edit their global- and database-specific privileges, change their password, or even copy those privileges to a new user.
删除用户¶
From the User accounts page, check the checkbox for the user you wish to remove, select whether or not to also remove any databases of the same name (if they exist), and click Go.
赋予用户特定数据库的权限¶
Users are assigned to databases by editing the user record (from the User accounts link on the home page). If you are creating a user specifically for a given table you will have to create the user first (with no global privileges) and then go back and edit that user to add the table and privileges for the individual table.
关系¶
phpMyAdmin allows relationships (similar to foreign keys) using MySQL-native (InnoDB) methods when available and falling back on special phpMyAdmin-only features when needed. There are two ways of editing these relations, with the relation view and the drag-and-drop designer – both of which are explained on this page.
注解
You need to have configured the phpMyAdmin配置存储 for using phpMyAdmin only relations.
技术信息¶
Currently the only MySQL table type that natively supports relationships is InnoDB. When using an InnoDB table, phpMyAdmin will create real InnoDB relations which will be enforced by MySQL no matter which application accesses the database. In the case of any other table type, phpMyAdmin enforces the relations internally and those relations are not applied to any other application.
关联视图¶
In order to get it working, you first have to properly create the [[pmadb|pmadb]]. Once that is setup, select a table’s “Structure” page. Below the table definition, a link called “Relation view” is shown. If you click that link, a page will be shown that offers you to create a link to another table for any (most) fields. Only PRIMARY KEYS are shown there, so if the field you are referring to is not shown, you most likely are doing something wrong. The drop-down at the bottom is the field which will be used as the name for a record.
关联视图示例¶


Let’s say you have categories and links and one category can contain several links. Your table structure would be something like this:
- category.category_id (必须是唯一的)
- category.name
- link.link_id
- link.category_id
- link.uri.
Open the relation view (below the table structure) page for the link table and for category_id field, you select category.category_id as master record.
If you now browse the link table, the category_id field will be a clickable hyperlink to the proper category record. But all you see is just the category_id, not the name of the category.

To fix this, open the relation view of the category table and in the drop down at the bottom, select “name”. If you now browse the link table again and hover the mouse over the category_id hyperlink, the value from the related category will be shown as tooltip.

设计器¶
The Designer feature is a graphical way of creating, editing, and displaying phpMyAdmin relations. These relations are compatible with those created in phpMyAdmin’s relation view.
To use this feature, you need a properly configured phpMyAdmin配置存储 and
must have the $cfg['Servers'][$i]['table_coords']
configured.
To use the designer, select a database’s structure page, then look for the Designer tab.
To export the view into PDF, you have to create PDF pages first. The Designer creates the layout, how the tables shall be displayed. To finally export the view, you have to create this with a PDF page and select your layout, which you have created with the designer.
图表¶
3.4.0 新版功能.
从 phpMyAdmin 3.4.0 版本起,你可以很容易的从 SQL 查询结果中生成图表。只需在“查询结果操作”区域中点击”显示图表”链接。

A window layer “Display chart” is shown in which you can customize the chart with the following options.
- Chart type: Allows you to choose the type of chart. Supported types are bar charts, column charts, line charts, spline charts, area charts, pie charts and timeline charts (only the chart types applicable for current series selection are offered).
- X-axis: Allows to choose the field for the main axis.
- Series: Allows to choose series for the chart. You can choose multiple series.
- Title: Allows specifying a title for the chart which is displayed above the chart.
- X-axis and Y-axis labels: Allows specifying labels for axes.
- Start row and a number of rows: Allows generating charts only for a specified number of rows of the results set.

示例¶
饼状图¶
可以这样生成查询结果的饼图表示:
SELECT 'Food' AS 'expense',
1250 AS 'amount' UNION
SELECT 'Accommodation', 500 UNION
SELECT 'Travel', 720 UNION
SELECT 'Misc', 220
查询的结果是:
expense | 数量 |
---|---|
Food | 1250 |
Accommodation | 500 |
Travel | 720 |
Misc | 220 |
Choosing expense as the X-axis and amount in series:

条形图和柱形图¶
Both bar charts and column chats support stacking. Upon selecting one of these types a checkbox is displayed to select stacking.
Query results for a simple bar or column chart can be generated with:
SELECT
'ACADEMY DINOSAUR' AS 'title',
0.99 AS 'rental_rate',
20.99 AS 'replacement_cost' UNION
SELECT 'ACE GOLDFINGER', 4.99, 12.99 UNION
SELECT 'ADAPTATION HOLES', 2.99, 18.99 UNION
SELECT 'AFFAIR PREJUDICE', 2.99, 26.99 UNION
SELECT 'AFRICAN EGG', 2.99, 22.99
查询的结果是:
标题 | rental_rate | replacement_cost |
---|---|---|
ACADEMY DINOSAUR | 0.99 | 20.99 |
ACE GOLDFINGER | 4.99 | 12.99 |
ADAPTATION HOLES | 2.99 | 18.99 |
AFFAIR PREJUDICE | 2.99 | 26.99 |
AFRICAN EGG | 2.99 | 22.99 |
Choosing title as the X-axis and rental_rate and replacement_cost as series:

散点图¶
Scatter charts are useful in identifying the movement of one or more variable(s) compared to another variable.
Using the same data set from bar and column charts section and choosing replacement_cost as the X-axis and rental_rate in series:

折线图、样条曲线图和时间线图¶
These charts can be used to illustrate trends in underlying data. Spline charts draw smooth lines while timeline charts draw X-axis taking the distances between the dates/time into consideration.
Query results for a simple line, spline or timeline chart can be generated with:
SELECT
DATE('2006-01-08') AS 'date',
2056 AS 'revenue',
1378 AS 'cost' UNION
SELECT DATE('2006-01-09'), 1898, 2301 UNION
SELECT DATE('2006-01-15'), 1560, 600 UNION
SELECT DATE('2006-01-17'), 3457, 1565
查询的结果是:
日期 | 收入 | 花费 |
---|---|---|
2016-01-08 | 2056 | 1378 |
2006-01-09 | 1898 | 2301 |
2006-01-15 | 1560 | 600 |
2006-01-17 | 3457 | 1565 |



导入与导出¶
导入¶
To import data, go to the “Import” tab in phpMyAdmin. To import data into a specific database or table, open the database or table before going to the “Import” tab.
In addition to the standard Import and Export tab, you can also import an SQL file directly by dragging and dropping it from your local file manager to the phpMyAdmin interface in your web browser.
If you are having troubles importing big files, please consult 1.16 我无法上传大转储文件(内存、HTTP或超时问题)。.
您可以使用以下方式导入:
基于表单的上传
可以用任何支持的格式,和经过压缩的文件,如 mydump.sql.gz。
基于表单的 SQL 查询
可以用于有效的 SQL 转储。
使用上传目录
You can specify an upload directory on your web server where phpMyAdmin is installed, after uploading your file into this directory you can select this file in the import dialog of phpMyAdmin, see$cfg['UploadDir']
.
phpMyAdmin 可以从不同广泛支持的格式中导入数据。
CSV¶
Comma separated values format which is often used by spreadsheets or various other programs for export/import.
注解
When importing data into a table from a CSV file where the table has an ‘auto_increment’ field, make the ‘auto_increment’ value for each record in the CSV field to be ‘0’ (zero). This allows the ‘auto_increment’ field to populate correctly.
It is now possible to import a CSV file at the server or database level. Instead of having to create a table to import the CSV file into, a best-fit structure will be determined for you and the data imported into it, instead. All other features, requirements, and limitations are as before.
CSV 使用 LOAD DATA¶
Similar to CSV, only using the internal MySQL parser and not the phpMyAdmin one.
ESRI 图形文件¶
The ESRI shapefile or simply a shapefile is a popular geospatial vector data format for geographic information systems software. It is developed and regulated by Esri as a (mostly) open specification for data interoperability among Esri and other software products.
MediaWiki¶
MediaWiki files, which can be exported by phpMyAdmin (version 4.0 or later), can now also be imported. This is the format used by Wikipedia to display tables.
Open Document Spreadsheet (ODS)¶
OpenDocument workbooks containing one or more spreadsheets can now be directly imported.
When importing an ODS spreadsheet, the spreadsheet must be named in a specific way in order to make the import as simple as possible.
数据表名¶
During import, phpMyAdmin uses the sheet name as the table name; you should rename the sheet in your spreadsheet program in order to match your existing table name (or the table you wish to create, though this is less of a concern since you could quickly rename the new table from the Operations tab).
字段名¶
You should also make the first row of your spreadsheet a header with the names of the columns (this can be accomplished by inserting a new row at the top of your spreadsheet). When on the Import screen, select the checkbox for “The first line of the file contains the table column names;” this way your newly imported data will go to the proper columns.
注解
Formulas and calculations will NOT be evaluated, rather, their value from the most recent save will be loaded. Please ensure that all values in the spreadsheet are as needed before importing it.
SQL¶
SQL can be used to make any manipulation on data, it is also useful for restoring backed up data.
XML¶
XML files exported by phpMyAdmin (version 3.3.0 or later) can now be imported. Structures (databases, tables, views, triggers, etc.) and/or data will be created depending on the contents of the file.
The supported xml schemas are not yet documented in this wiki.
导出¶
phpMyAdmin can export into text files (even compressed) on your local disk (or
a special the webserver $cfg['SaveDir']
folder) in various
commonly used formats:
CodeGen¶
NHibernate file format. Planned versions: Java, Hibernate, PHP PDO, JSON, etc. So the preliminary name is codegen.
CSV¶
Comma separated values format which is often used by spreadsheets or various other programs for export/import.
CSV for Microsoft Excel¶
This is just preconfigured version of CSV export which can be imported into most English versions of Microsoft Excel. Some localised versions (like “Danish”) are expecting “;” instead of “,” as field separator.
微软 Word 2000¶
If you’re using Microsoft Word 2000 or newer (or compatible such as OpenOffice.org), you can use this export.
JSON¶
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write and it is easy for machines to parse and generate.
在 4.7.0 版更改: The generated JSON structure has been changed in phpMyAdmin 4.7.0 to produce valid JSON data.
The generated JSON is list of objects with following attributes:
-
type
¶ Type of given object, can be one of:
header
- Export header containing comment and phpMyAdmin version.
database
- Start of a database marker, containing name of database.
table
- Table data export.
-
comment
¶ Optional textual comment.
Sample output:
[
{
"comment": "Export to JSON plugin for PHPMyAdmin",
"type": "header",
"version": "4.7.0-dev"
},
{
"name": "cars",
"type": "database"
},
{
"data": [
{
"car_id": "1",
"description": "Green Chrysler 300",
"make_id": "5",
"mileage": "113688",
"price": "13545.00",
"transmission": "automatic",
"yearmade": "2007"
}
],
"database": "cars",
"name": "cars",
"type": "table"
},
{
"data": [
{
"make": "Chrysler",
"make_id": "5"
}
],
"database": "cars",
"name": "makes",
"type": "table"
}
]
LaTeX¶
If you want to embed table data or structure in LaTeX, this is right choice for you.
LaTeX is a typesetting system that is very suitable for producing scientific and mathematical documents of high typographical quality. It is also suitable for producing all sorts of other documents, from simple letters to complete books. LaTeX uses TeX as its formatting engine. Learn more about TeX and LaTeX on the Comprehensive TeX Archive Network also see the short description od TeX.
The output needs to be embedded into a LaTeX document before it can be rendered, for example in following document:
\documentclass{article}
\title{phpMyAdmin SQL output}
\author{}
\usepackage{longtable,lscape}
\date{}
\setlength{\parindent}{0pt}
\usepackage[left=2cm,top=2cm,right=2cm,nohead,nofoot]{geometry}
\pdfpagewidth 210mm
\pdfpageheight 297mm
\begin{document}
\maketitle
% insert phpMyAdmin LaTeX Dump here
\end{document}
MediaWiki¶
Both tables and databases can be exported in the MediaWiki format, which is used by Wikipedia to display tables. It can export structure, data or both, including table names or headers.
OpenOffice 表格¶
Open standard for spreadsheet data, which is being widely adopted. Many recent spreadsheet programs, such as LibreOffice, OpenOffice, Microsoft Office or Google Docs can handle this format.
OpenOffice 文档¶
New standard for text data which is being widely adopted. Most recent word processors (such as LibreOffice, OpenOffice, Microsoft Word, AbiWord or KWord) can handle this.
PDF¶
For presentation purposes, non editable PDF might be best choice for you.
PHP 数组¶
You can generate a php file which will declare a multidimensional array with the contents of the selected table or database.
SQL¶
Export in SQL can be used to restore your database, thus it is useful for backing up.
The option ‘Maximal length of created query’ seems to be undocumented. But experiments has shown that it splits large extended INSERTS so each one is no bigger than the given number of bytes (or characters?). Thus when importing the file, for large tables you avoid the error “Got a packet bigger than ‘max_allowed_packet’ bytes”.
数据选项¶
Complete inserts adds the column names to the SQL dump. This parameter improves the readability and reliability of the dump. Adding the column names increases the size of the dump, but when combined with Extended inserts it’s negligible.
Extended inserts combines multiple rows of data into a single INSERT query. This will significantly decrease filesize for large SQL dumps, increases the INSERT speed when imported, and is generally recommended.
Texy!¶
Texy! markup format. You can see example on Texy! demo.
XML¶
Easily parsable export for use with custom scripts.
在 3.3.0 版更改: The XML schema used has changed as of version 3.3.0
YAML¶
YAML 是一种兼顾人类可读性和计算机处理能力的数据序列化格式(<https://yaml.org>)。
自定义主题¶
phpMyAdmin 带有对第三方主题的支持。你可以从我们的网站 <https://www.phpmyadmin.net/themes/> 下载额外的主题。
设置¶
Themes are configured with $cfg['ThemeManager']
and
$cfg['ThemeDefault']
. Under ./public/themes/
, you should not
delete the directory pmahomme
or its underlying structure, because this is
the system theme used by phpMyAdmin. pmahomme
contains all images and
styles, for backwards compatibility and for all themes that would not include
images or css-files. If $cfg['ThemeManager']
is enabled, you
can select your favorite theme on the main page. Your selected theme will be
stored in a cookie.
创建自定义主题¶
要创建一个主题,请按照下面的方法进行操作:
- make a new subdirectory (for example “your_theme_name”) under
./public/themes/
. - 将文件和目录从
pmahomme
复制到您的主题目录下 - 编辑 “your_theme_name/css” 文件夹中的 css 文件
- 将您的新图片放到 “your_theme_name/img” 文件夹中
- 编辑 “your_theme_name/scss” 目录下的
_variables.scss
文件 - 编辑您的主题目录下的`theme.json`来包含主题元数据(见下文)
- 为您的主题制作一张屏幕截图并保存到“your_theme_name/screen.png”
主题元数据¶
在 4.8.0 版更改: 在版本4.8.0之前,主题元数据是在 info.inc.php
文件中传递。它已被 theme.json
所取代,以便更容易解析(不需要处理PHP代码)并支持额外的功能。
在主题目录中有一个文件 theme.json
,它包含了主题元数据。目前它由以下内容组成:
-
name
主题的显示名称。
此字段为必填字段。
-
version
主题的版本,可以人工指定,无需与 phpMyAdmin 的版本匹配。
此字段为必填字段。
-
description
主题描述,会在网站上显示。
此字段为必填字段。
-
author
主题作者名称。
此字段为必填字段。
-
url
到主题作者的网站链接,可以获取支持。
-
supports
由所支持 phpMyAdmin 的主要版本组成的数组。
此字段为必填字段。
例如,phpMyAdmin 4.8 版本自带的原始主题定义如下:
{
"name": "Original",
"version": "4.8",
"description": "Original phpMyAdmin theme",
"author": "phpMyAdmin developers",
"url": "https://www.phpmyadmin.net/",
"supports": ["4.8"]
}
共享图片资源¶
如果您的主题不需要使用自己的图标和按钮,请删除您的主题目录“your_theme_name”下的“img”目录。phpMyAdmin 将使用默认的图标和按钮(位于 pmahomme
目录下的系统主题)。
FAQ - 常见问题¶
请到我们的 官方网站 的链接部分查看更多有关 phpMyAdmin 的特性和接口方面的信息。
服务器¶
1.1 我的服务器不是在处理特定请求时崩溃就是 phpMyAdmin 发送空白页面或者都是乱码的页面,我该怎么办?¶
在 config.inc.php
文件中将 $cfg['OBGzip']
显式地设为 false
,同时将 PHP 配置文件中的 zlib.output_compression
显式地设置为 Off
。
1.2 使用 phpMyAdmin 时,我的 Apache 服务器崩溃了。¶
你应该首先尝试安装最新版本的 Apache(也许也需要 MySQL)。如果你的服务器依旧崩溃,请向 Apache 技术支持小组寻求帮助。
1.3 (withdrawn).¶
1.4 在IIS上使用phpMyAdmin时,我会显示错误消息:“指定的CGI应用程序因未返回完整的HTTP头……”。¶
您是不是忘记阅读 PHP 发行版中的*install.txt* 了?请参考 PHP 官方错误数据库中的 12061 号错误反馈 <http://bugs.php.net/bug.php?id=12061> _ 。
1.5 在IIS上使用phpMyAdmin时,我面临HTTP崩溃和/或许多错误消息。¶
这是一个已知的 PHP ISAPI 过滤器错误:PHP 的 ISAPI 过滤器不是很稳定,建议使用 cookie 认证方式。
1.6 我无法在 PWS 上使用 phpMyAdmin,网页显示一片空白!¶
This seems to be a PWS bug. Filippo Simoncini found a workaround (at
this time there is no better fix): remove or comment the DOCTYPE
declarations (2 lines) from the scripts src/Header.php
and index.php
.
1.7 我如何gzip转储或CSV导出?它似乎不起作用。¶
该功能基于 PHP 的 gzencode()
函数。为了兼容性需求(无论是Unix、Windows,还是安全模式与否),你的安装必需具有 Zlib 支持( --with-zlib
)。
1.8 我无法在表中插入文本文件,我收到一个关于安全模式生效的错误。¶
Your uploaded file is saved by PHP in the “upload dir”, as defined in
php.ini
by the variable upload_tmp_dir
(usually the system
default is /tmp). We recommend the following setup for Apache
servers running in safe mode, to enable uploads of files while being
reasonably secure:
- 创建一个用于临时保存上传文件的目录:mkdir /tmp/php
- 将目录的所有权更改为 Apache 用户组:chown apache.apache /tmp/php
- 设置权限:chmod 600 /tmp/php
- 修改
php.ini
文件,将upload_tmp_dir
设置为/tmp/php
- 重新启动 Apache
1.9 (withdrawn).¶
1.10 在安全服务器上运行 phpMyAdmin 时上传文件时遇到问题。我的浏览器是 Internet Explorer,正在使用 Apache 服务器。¶
Rob M 在 PHP 帮助论坛给出了解决方法:将下面一行加入到您的 httpd.conf 文件中:
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
该方法似乎可以解决许多使用 Internet Explorer 或 SSL 时遇到的问题。
1.11 从“导入”选项卡上载文件时,我收到“打开_basedir 限制”。¶
从 2.2.4 版本开始,phpMyAdmin 支持服务器的 open_basedir 限制。但是,你需要进行设置才能使用此功能。请创建一个临时目录,并将 $cfg['TempDir']
设置为临时目录的路径。您上传的文件将会被临时存放在此目录下,SQL 语句执行完毕以后,临时文件就会被删除。
1.12 我忘记了 MySQL 的 root 密码,怎么办?¶
phpMyAdmin does authenticate against MySQL server you’re using, so to recover from phpMyAdmin password loss, you need to recover at MySQL level.
请参考 MySQL 手册:如何重设权限 。
If you are using MySQL server installed by your hosting provider, please contact their support to recover the password for you.
1.13 (withdrawn).¶
1.14 (withdrawn).¶
1.15 我对 mysql.user 字段有疑问。¶
在较老的 MySQL 版本中, User
和 Password
字段分别被命名为 user
和 password
。请修改您的字段名中的大小写使其符合标准。
1.16 我无法上传大转储文件(内存、HTTP或超时问题)。¶
phpMyAdmin 在 2.7.0 重写了导入引擎,并修复了以上问题。如果可能,请升级 phpMyAdmin 到最新版本,并体验新版 phpMyAdmin 给您带来的新特性。
请检查 php.ini
文件中的 max_execution_time
、 upload_max_filesize
、 memory_limit
以及 post_max_size
的设置值。这四个选项都会影响您可以上传的文件大小和 PHP 能够处理的文件大小。如果您没有服务器管理权,请联系服务器管理员(或服务器提供商)检查这几项设置。另外,要注意 post_max_size
的设置值必须比 upload_max_filesize
的设置值大。如果你的上传量太大或者你的主机提供商不愿意更改设置,有几种解决方法:
查看
$cfg['UploadDir']
功能。这允许用户通过 scp、FTP 或您喜欢的文件传输方法将文件上传到服务器。然后,PhpMyAdmin 可以从临时目录导入文件。详细说明请参考本手册的 设置 。使用第三方工具(如 BigDump )来将上传文件分割成小文件。phpMyAdmin 无法直接支持此特性或任何第三方应用,但我们知道有用户成功使用了这个特性。
如果您能够使用 MySQL 的命令行,您可以直接在命令行中导入文件。您可以通过在MySQL中发出“source”命令来实现这一点:
source filename.sql;
1.17.1 phpMyAdmin 支持哪些数据库版本?¶
对于 MySQL 来说,支持 5.5 及以上的版本。对于较旧的 MySQL 版本,我们的 下载 页面提供了较旧的 phpMyAdmin 版本下载(可能已经停止支持)。
对于 MariaDB 来说,支持 5.5 及以上的版本。
1.17a 我无法连接到 MySQL 服务器,它总是提示这个错误:"客户端不支持服务器要求的认证方式,请升级 MySQL 客户端"¶
您尝试使用旧的MySQL客户端库访问MySQL。可以在 phpinfo() 输出中检查MySQL客户端库的版本。通常它应该至少与您的服务器具有相同的小版本——如 1.17.1 phpMyAdmin 支持哪些数据库版本? 中所述。此问题通常是由使用 MySQL 4.1 或更高版本引起的。MySQL 更改了身份验证散列值,并且您的 PHP 正在尝试使用旧方法。正确的解决方案是使用 mysqli 扩展 与适当的客户端库匹配您的 MySQL 安装。更多信息(和几个解决方法)位于 MySQL 文档 。
1.18 (withdrawn).¶
1.19 我无法使用“显示关系”功能,似乎脚本不认识我正在使用的字体!¶
在此功能中我们使用了 TCPDF 库,该库还需要其他的一些文件才能使用自定义字体(font faces)。请参考 `TCPDF 手册<https://tcpdf.org>`_ 以了解如何构建这些文件。
1.20 我收到丢失 mysqli 和 mysql 扩展的报错。¶
要连接到 MySQL 服务器,PHP 需要使用 “MySQL extension” (MySQL扩展)中相关的 MySQL 函数。这个扩展应该需要编译到 PHP 中,或者以动态方式加载。如果是以动态方式加载,动态库的文件有可能是 mysqli.so 或 php_mysqli.dll。phpMyAdmin 试图加载动态库文件,但加载失败了。通常,软件包”PHP-MySQL”或者类似的软件包会解决这个问题。
There was two interfaces PHP provided as MySQL extensions - mysql
and mysqli
. The mysql
interface was removed in PHP 7.0.
This problem can be also caused by wrong paths in the php.ini
or using
wrong php.ini
.
Make sure that the extension files do exist in the folder which the
extension_dir
points to and that the corresponding lines in your
php.ini
are not commented out (you can use phpinfo()
to check
current setup):
[PHP]
; Directory in which the loadable extensions (modules) reside.
extension_dir = "C:/Apache2/modules/php/ext"
The php.ini
can be loaded from several locations (especially on
Windows), so please check you’re updating the correct one. If using Apache, you
can tell it to use specific path for this file using PHPIniDir
directive:
LoadModule php7_module "C:/php7/php7apache2_4.dll"
<IfModule php7_module>
PHPIniDir "C:/php7"
<Location>
AddType text/html .php
AddHandler application/x-httpd-php .php
</Location>
</IfModule>
In some rare cases this problem can be also caused by other extensions loaded
in PHP which prevent MySQL extensions to be loaded. If anything else fails, you
can try commenting out extensions for other databases from php.ini
.
1.21 我正在Unix下运行PHP的CGI版本,无法使用cookie认证登录。¶
在 php.ini
文件中将 mysql.max_links
设为大于 1 的值。
1.22 我看不到“文本文件位置”字段,因此无法上传。¶
通常这是因为您没有在 php.ini
中将 file_uploads
选项设置为 “on”。
1.23 我在 Win32 系统上使用 MySQL,每次我创建表的时候列名都会被自动设为全小写,这是怎么回事?¶
这是因为 Win32 版本的 MySQL 默认将 lower_case_table_names
设置为1( ON
)。您可以将此设置显式地设为0(也就是 OFF
)来解决这个问题:在您的 Windows 目录下,编辑 my.ini
文件,添加以下几行配置到 [mysqld] 组中:
set-variable = lower_case_table_names=0
注解
Forcing this variable to 0 with –lower-case-table-names=0 on a case-insensitive filesystem and access MyISAM tablenames using different lettercases, index corruption may result.
然后,重新启动 MySQL。您也可以使用如下的查询语句来查询此设置值
SHOW VARIABLES LIKE 'lower_case_table_names';
1.24(已撤销)。¶
1.25 我在Windows XP上运行带有mod_gzip-1.3.26.1a的Apache,遇到了一些问题,例如在运行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 我刚刚在IIS的文档根目录中安装了phpMyAdmin,但在尝试运行phpMyAdmin时出现错误“未指定输入文件”。¶
这是个权限问题。右键点击 phpmyadmin 文件夹,选择属性。在 “安全” 标签下,点击 “添加”,从列表中选择用户 “IUSR_machine”。现在设置他们的权限,应该可以奏效了。
1.27 当我想查看巨大的页面时,我会得到一个空页面(例如 带有大量表格的 db_structure.php)。¶
这是一个 PHP 错误 ,该错误会在打开 GZIP 输出缓存的时候发生。如果您在 config.inc.php
中修改 $cfg['OBGzip']
选项来关闭这个功能,就能解决此问题。这个错误将会在 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 当我创建一个表或修改一列时,我会得到一个错误,并且这些列是重复的。¶
这可能是因为没有正确配置 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”,所以只需注释掉第一组行,然后重新启动Apache:
#SetOutputFilter PHP
#SetInputFilter PHP
1.31 phpMyAdmin 支持哪些 PHP 版本?¶
Since release 4.5, phpMyAdmin supports only PHP 5.5 and newer. Since release 4.1 phpMyAdmin supports only PHP 5.3 and newer. For PHP 5.2 you can use 4.0.x releases.
PHP 7 is supported since phpMyAdmin 4.6, PHP 7.1 is supported since 4.6.5, PHP 7.2 is supported since 4.7.4.
HHVM is supported up to phpMyAdmin 4.8.
Since release 5.0, phpMyAdmin supports only PHP 7.1 and newer. Since release 5.2, phpMyAdmin supports only PHP 7.2 and newer. Since release 6.0, phpMyAdmin supports only PHP 8.1 and newer.
1.32 我可以配合 IIS 使用 HTTP 认证吗?¶
答案是肯定的。我们在 IIS 5.1 上以 ISAPI 方式使用 PHP 4.3.9 来测试 phpMyAdmin 2.6.1,结果可以正常使用 phpMyAdmin。
- 请在
php.ini
文件中作如下设置: cgi.rfc2616_headers = 0 - 打开
站点属性 -> 目录安全性 -> 匿名访问
对话框,选中匿名访问
复选框,并取消选中其他复选框(如基本身份验证
、集成 Windows 身份验证
、集成 Windows 认证
和摘要
)。 - 在
自定义错误
选项卡中,选中401;1
到401;5
条目,然后点击设为默认
按钮。
参见
1.33 (withdrawn).¶
1.34 我能直接访问数据库或表格页面吗?¶
Yes. Out of the box, you can use a URL like
http://server/phpMyAdmin/index.php?server=X&db=database&table=table&target=script
.
For server
you can use the server number
which refers to the numeric host index (from $i
) in
config.inc.php
. The table and script parts are optional.
如果您需要像 http://server/phpMyAdmin/database[/table][/script]
这样的 URL 地址,您需要做一些额外的配置。下面给出在 Apache <https://httpd.apache.org> 服务器上进行设置的方法。首先请确定您已经在全局范围内启用了 Options FollowSymLinks
和 AllowOverride FileInfo
功能,然后,在 phpMyAdmin 的目录配置下启用这两个功能和 mod_rewrite。接着,在 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]
在 5.1.0 版更改: 在 phpMyAdmin 5.1.0 中,移除了对 target
参数的支持,请使用 route
参数替代。
1.35 我将 PHP 配置为在 Apache 上以 CGI 方式运行。在这种情况下我能否使用 HTTP 认证?¶
可以,但您需要设置以下重写规则,以便将认证参数传送给 CGI:
RewriteEngine On
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]
1.36 我收到一个错误“500内部服务器错误”。¶
导致这种情况的原因有很多种,请查看您的服务器错误日志,其中可能包含了有关的错误信息。
1.37 我在不同机器的集群上运行phpMyAdmin,cookie中的密码加密不起作用。¶
如果您的集群中存在不同体系结构的系统,就会导致 PHP 无法使用 pack/unpack 函数进行正确的加解密操作。解决此问题的方法是使用 openssl 扩展。
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:
- suhosin.request.max_vars should be increased (eg. 2048)
- suhosin.post.max_vars should be increased (eg. 2048)
- suhosin.request.max_array_index_length should be increased (eg. 256)
- suhosin.post.max_array_index_length should be increased (eg. 256)
- suhosin.request.max_totalname_length should be increased (eg. 8192)
- suhosin.post.max_totalname_length should be increased (eg. 8192)
- suhosin.get.max_value_length should be increased (eg. 1024)
- suhosin.sql.bailout_on_error needs to be disabled (the default)
- suhosin.log.* should not include SQL, otherwise you get big slowdown
- suhosin.sql.union must be disabled (which is the default).
- suhosin.sql.multiselect must be disabled (which is the default).
- suhosin.sql.comment must be disabled (which is the default).
To further improve security, we also recommend these modifications:
- suhosin.executor.include.max_traversal should be
enabled as a mitigation against local file inclusion attacks. We suggest
setting this to 2 as
../
is used with the ReCaptcha library. - suhosin.cookie.encrypt should be enabled.
- suhosin.executor.disable_emodifier should be enabled.
You can also disable the warning using the $cfg['SuhosinDisableWarning']
.
1.39 当我尝试使用 https 连接时,我可以成功登录,但是会重定向回 http 连接,是什么导致了这个行为?¶
这是因为 PHP 脚本不知道网站是使用 https 的。根据所使用的网站服务器,应该对其进行配置,让 PHP 知道用来访问它的 URL 和协议。
例如,在 Apache 中,确保你在配置中启用了 SSLOptions
和 StdEnvVars
。
1.40 当使用 Apache 反向代理来访问 phpMyAdmin 时,无法使用 cookie 认证方式登录。¶
为了能够使用cookie 认证,Apache必须知道它必须重写设置的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。 这不是 phpmyadmin 规定,而是 Apache 的行为。
ProxyPass /mirror/foo/ http://backend.example.com/~user/phpmyadmin
ProxyPassReverse /mirror/foo/ http://backend.example.com/%7Euser/phpmyadmin
ProxyPassReverseCookiePath /%7Euser/phpmyadmin /mirror/foo
1.41 当我需要查看数据库权限时,会得到“未知字段”的报错。¶
MySQL 服务器的权限表没有更新,请运行 mysql_upgrade 命令来进行更新。
1.42 如何阻止爬虫机器人访问 phpMyAdmin?¶
You can add various rules to .htaccess to filter access based on user agent field. This is quite easy to circumvent, but could prevent at least some robots accessing your installation.
RewriteEngine on
# Allow only GET and POST verbs
RewriteCond %{REQUEST_METHOD} !^(GET|POST)$ [NC,OR]
# Ban Typical Vulnerability Scanners and others
# Kick out Script Kiddies
RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget).* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*(libwww-perl|curl|wget|python|nikto|wkito|pikto|scan|acunetix).* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*(winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner).* [NC,OR]
# Ban Search Engines, Crawlers to your administrative panel
# No reasons to access from bots
# Ultimately Better than the useless robots.txt
# Did google respect robots.txt?
# Try google: intitle:phpMyAdmin intext:"Welcome to phpMyAdmin *.*.*" intext:"Log in" -wiki -forum -forums -questions intext:"Cookies must be enabled"
RewriteCond %{HTTP_USER_AGENT} ^.*(AdsBot-Google|ia_archiver|Scooter|Ask.Jeeves|Baiduspider|Exabot|FAST.Enterprise.Crawler|FAST-WebCrawler|www\.neomo\.de|Gigabot|Mediapartners-Google|Google.Desktop|Feedfetcher-Google|Googlebot|heise-IT-Markt-Crawler|heritrix|ibm.com\cs/crawler|ICCrawler|ichiro|MJ12bot|MetagerBot|msnbot-NewsBlogs|msnbot|msnbot-media|NG-Search|lucene.apache.org|NutchCVS|OmniExplorer_Bot|online.link.validator|psbot0|Seekbot|Sensis.Web.Crawler|SEO.search.Crawler|Seoma.\[SEO.Crawler\]|SEOsearch|Snappy|www.urltrends.com|www.tkl.iis.u-tokyo.ac.jp/~crawler|SynooBot|crawleradmin.t-info@telekom.de|TurnitinBot|voyager|W3.SiteSearch.Crawler|W3C-checklink|W3C_Validator|www.WISEnutbot.com|yacybot|Yahoo-MMCrawler|Yahoo\!.DE.Slurp|Yahoo\!.Slurp|YahooSeeker).* [NC]
RewriteRule .* - [F]
1.43 为什么不能显示包含上百个字段的表结构?¶
您的 PHP 配置 memory_limit
太低了,请提高 php.ini
文件中该项配置的值。
1.44 我如何减少硬盘上 phpMyAdmin 的占用空间?¶
Some users have requested to be able to reduce the size of the phpMyAdmin installation. This is not recommended and could lead to confusion over missing features, but can be done. A list of files and corresponding functionality which degrade gracefully when removed include:
./locale/
folder, or unused subfolders (interface translations)- Any unused themes in
./public/themes/
except the default theme pmahomme. ./libraries/language_stats.inc.php
(translation statistics)./doc/
(documentation)./setup/
(setup script)./examples/
(configuration examples)./sql/
(SQL scripts to configure advanced functionalities)./js/src/
(Source files to re-build ./js/dist/)./js/global.d.ts
JS type declaration file- Run rm -rv vendor/tecnickcom/tcpdf && composer dump-autoload –no-interaction –optimize –dev (exporting to PDF)
- Run rm -rv vendor/williamdes/mariadb-mysql-kbs && composer dump-autoload –no-interaction –optimize –dev (external links to MariaDB and MySQL documentations)
- Run rm -rv vendor/code-lts/u2f-php-server && composer dump-autoload –no-interaction –optimize –dev (U2F second factor authentication)
- Run rm -rv vendor/pragmarx/* && composer dump-autoload –no-interaction –optimize –dev (2FA second factor authentication)
- Run rm -rv vendor/bacon/bacon-qr-code && composer dump-autoload –no-interaction –optimize –dev (QRcode generation for 2FA second factor authentication)
1.45 尝试登录时,我收到错误信息“未知的认证方法 caching_sha2_password”¶
当使用版本号为 8 及以上的 MySQL 登录时,您可能会遇到这样的错误消息:
mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client
This error is because of a version compatibility problem between PHP and MySQL. The MySQL project introduced a new authentication method (our tests show this began with version 8.0.11) however PHP did not include the ability to use that authentication method. PHP reports that this was fixed in PHP version 7.4.
Users experiencing this are encouraged to upgrade their PHP installation, however a workaround exists. Your MySQL user account can be set to use the older authentication with a command such as
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'PASSWORD';
设置¶
2.1 页面显示 “Warning: Cannot add header information - headers already sent by …”,怎么办?¶
请检查 config.inc.php
文件,确保在 <?php
之前和 ?>
标签之后没有任何字符(包括空格、制表符以及空行等)。
2.2 phpMyAdmin 无法连接到 MySQL 服务器,这是怎么回事?¶
这可能是因为您的 PHP 配置有误,或者您使用的登录名或密码错误。请写一个脚本,使用 mysql_connect 来尝试是否能连接到 MySQL 服务器,如果不能,就说明您可能没有将 MySQL 功能支持编译到 PHP 中。
2.3 网页显示 “Warning: MySQL Connection Failed: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (111) …” 这样的错误,怎么办?¶
错误信息也可以是: Error #2002 - The server is not responding (or the local MySQL server’s socket is not correctly configured)。
首先,你需要确定 MySQL 使用的 socket。用终端连接到你的 MySQL 服务器并切换到 MySQL 的 bin 目录,在这个目录下你应该能找到一个名为 mysqladmin 的文件。执行 ./mysqladmin variables
命令,你就能得到 MySQL 服务器的信息,其中包括了 socket 信息(如 /tmp/mysql.sock )。你也可以询问你的 ISP 这些连接信息,或者,如果运行在自己的设备上,使用 ‘mysql’ 命令行客户端并输入 ‘status’ 以获得连接类型和 socket 或端口号码。
Then, you need to tell PHP to use this socket. You can do this for all PHP in
the php.ini
or for phpMyAdmin only in the config.inc.php
. For
example: $cfg['Servers'][$i]['socket']
Please also make sure
that the permissions of this file allow to be readable by your webserver.
在 RedHat 服务器上,MySQL 的 socket 是 /var/lib/mysql/mysql.sock,你应该能在 php.ini
文件中找到这样一行
mysql.default_socket = /tmp/mysql.sock
将其修改为
mysql.default_socket = /var/lib/mysql/mysql.sock
之后重新启动 Apache,即可解决问题。
更多信息请参考 MySQL 文档对应的部分 。
2.4 我运行 phpMyAdmin 的时候,浏览器什么都没有显示,怎么办?¶
尝试将 phpMyAdmin 配置文件的 $cfg['OBGzip']
指令设为 false
,有时可以奏效。另外,请查看您的 PHP 版本号,如果版本号包含了字符串 “b” 或 “alpha”,说明这是一个测试版的 PHP,使用测试版可能会产生一些奇怪的问题,请将 PHP 升级到稳定版。
2.5 当我插入、修改或删除记录、表或数据库时,浏览器总是显示 404 (找不到网页)。另外,如果使用 HTTP 或 cookie 认证方式,phpMyAdmin 会要求重新登录,这是怎么回事?¶
检查你的网站服务器设置是否正确填写了 PHP_SELF 或 REQUEST_URI 变量。
如果您在反向代理环境下运行 phpMyAdmin,请在 phpMyAdmin 的配置文件中检查您是否显式地设定了 $cfg['PmaAbsoluteUri']
。
2.6 我收到报错信息 “Access denied for user: ‘root@localhost’ (Using password: YES)”,尝试访问为我的本地主机转发端口的主机上的MySQL服务器时出错。¶
When you are using a port on your localhost, which you redirect via port-forwarding to another host, MySQL is not resolving the localhost as expected. 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. If you enter “127.0.0.1” as hostname, everything is right and MySQL uses the TCP connection.
2.8 我遇到 “缺少参数” 的错误提示,怎么办?¶
请先检查以下几点:
- In
config.inc.php
, try to leave the$cfg['PmaAbsoluteUri']
directive empty. See also 4.7 为什么认证窗口显示了很多次?. - 可能您安装的 PHP 版本有问题,试试升级 Zend Optimizer。请参考 <https://bugs.php.net/bug.php?id=31134> 。
- 如果您使用 Hardened PHP 并在 php.ini 中将
varfilter.max_request_variables
显式地设为了小于等于默认值(200)的值,就可能会导致此问题。如果您的表中有很多字段,请增加此设置的值(感谢 Klaus Dorninger 提供的信息)。 - 如果在
php.ini
中arg_separator.input
选项被设置为 “;” 就有可能导致此问题。请将其更换为 “&;”。 - 如果您正在使用 Suhosin ,请增大 request limits 的设置值。
- 如果
php.ini
中的选项session.save_path
设定的目录不存在或者目录权限为只读,可能导致此问题(PHP 安装的 bug 可能会导致这个问题)。
2.9 怎样设置才能显示上传进度条?¶
要使用此功能,请在服务器上安装 uploadprogress 扩展,并确保运行在 PHP 5.4.0 及更新的版本上,另外,还要启用 JSON 扩展。
如果正在使用 PHP 5.4.0 及更新的版本,必须将 php.ini
中的 session.upload_progress.enabled
设置为 1
。然而,从 phpMyAdmin 4.0.4 版本开始,基于会话实现的上传进度由于迷惑行为已经暂时禁用了。
2.10 如何生成随机比特字符串¶
One way to generate a string of random bytes suitable for cryptographic use is using the random_bytes PHP function. Since this function returns a binary string, the returned value should be converted to printable format before being able to copy it.
For example, the $cfg['blowfish_secret']
configuration directive requires a 32-bytes long string. The
following command can be used to generate a hexadecimal representation of this string.
php -r 'echo bin2hex(random_bytes(32)) . PHP_EOL;'
The above example will output something similar to:
f16ce59f45714194371b48fe362072dc3b019da7861558cd4ad29e4d6fb13851
And then this hexadecimal value can be used in the configuration file.
$cfg['blowfish_secret'] = sodium_hex2bin('f16ce59f45714194371b48fe362072dc3b019da7861558cd4ad29e4d6fb13851');
The sodium_hex2bin function is used here to convert the hexadecimal value back to the binary format.
已知限制¶
3.1 使用HTTP身份验证时,已注销的用户不能使用同一身份再次登录。¶
这是 phpMyAdmin 的认证机制引起的问题。要解决此问题,请关闭所有已打开的 Windows 文件夹,然后重新登录 phpMyAdmin。
3.2 在压缩模式下转储大表时,会出现内存限制错误或时间限制错误。¶
压缩转储在内存中进行,而 PHP 对内存的使用有限制。从 2.5.4 版本开始,可以使用 Gzip/BZip2 :config:option: $cfg[‘CompressOnFly’] 选项(默认启用)来解决问题。此方法不支持 Zip 导出,要进行 Zip 导出,需要使用其他的方法。
3.3 使用InnoDB表,我在重命名表或列时会丢失外键关系。¶
这是一个 InnoDB 引擎的错误,请参考:<https://bugs.mysql.com/bug.php?id=21704>。
3.4 我无法导入用 MySQL 服务器工具 mysqldump 生成的转储文件。¶
这是因为旧版本的 mysqldump
生成了错误的注释行,就像下面这样:
-- MySQL dump 8.22
--
-- Host: localhost Database: database
---------------------------------------------------------
-- Server version 3.23.54
错误的注释是那行由短横线组成的水平线,正确的注释应该是两个短横线后面跟一个空格。所以,要解决此问题,请在水平线的前两个短横线后加上一个空格,或直接在水平线的前面加上一个#符号,就像下面这样:-- -------------------------------------------------------
或 #---------------------------------------------------------
3.5 当使用嵌套文件夹时,多层级关系显示错误。¶
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 (withdrawn).¶
3.7 我拥有一张字段数上百个的表格,当浏览表格时,出现一系列类似于“Warning: unable to parse url”的错误,怎么修复它?¶
Your table neither have a primary key nor an unique key, 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 key 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 当在 MySQL 服务器上使用 “–sql_mode=ANSI” 时,会收到报错信息。¶
When MySQL is running in ANSI-compatibility mode, there are some major differences in how SQL is structured (see <https://dev.mysql.com/doc/refman/5.7/en/sql-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 issue #7383.
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 InnoDB 引擎表格的行数不对。¶
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.
However, one can easily replace the approximate row count with exact count by
simply clicking on the approximate count. This can also be done for all tables
at once by clicking on the rows sum displayed at the bottom.
3.12 (withdrawn).¶
3.13 当输入 USE
命令后接一个带连字符的数据库名称时,会遇到报错。¶
The tests I have made with MySQL 5.1.49 shows that the API does not accept this syntax for the USE command.
3.14 我无法浏览不具有某一列 SELECT 权限的表格。¶
这是 phpMyAdmin 从一开始就已知的限制,未来不太可能会解决。
3.15 (withdrawn).¶
3.16 (withdrawn).¶
3.17 (withdrawn).¶
3.18 当我导入包含多个表的CSV文件时,它们被集中到一个表中。¶
There is no reliable way to differentiate tables in CSV format. For the time being, you will have to break apart CSV files containing multiple tables.
3.19 当我导入一个文件,并且让 phpMyAdmin 决定数据的合适类型时,它只能使用 int、decimal 和 varchar 类型。¶
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.
3.20 在升级之后,部分书签消失了,不能显示它们的内容。¶
At some point, the character set used to store bookmark content has changed. It’s better to recreate your bookmark from the newer phpMyAdmin version.
3.21 I am unable to log in with a username containing unicode characters such as á.¶
This can happen if MySQL server is not configured to use utf-8 as default charset. This is a limitation of how PHP and the MySQL server interact; there is no way for PHP to set the charset before authenticating.
ISP 与多用户安装¶
4.1 我是互联网服务提供商(ISP),我可以在服务中心只安装一遍 phpMyAdmin ,还是需要每个客户都要安装一遍?¶
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.
参见
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.
建议:
- 您的
config.inc.php
文件的模式应该是chmod 660
。 - All your phpMyAdmin files should be chown -R phpmy.apache, where phpmy is a user whose password is only known to you, and apache is the group under which Apache runs.
- 遵从 PHP 和服务器的安全推荐手段。
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 使用 HTTP 认证时,phpMyAdmin 总会报错 “拒绝访问”。¶
导致发生错误的原因:
$cfg['Servers'][$i]['controluser']
和/或$cfg['Servers'][$i]['controlpass']
是错误的。- 登录对话框中输入的用户名/密码无效。
- 您已经为 phpMyAdmin 目录设定了安全机制,如 :term: .htaccess 文件。这会干扰 phpMyAdmin 的认证系统,请移除它。
4.5 可以让用户创建他们自己的数据库吗?¶
从2.2.5版本开始可用,在用户管理页面,你可以为用户输入数据库名的通配符(如 “joe%”),并赋予你想要的权限。例如,加入 SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER
可以令用户创建或管理他们的数据库。
4.6 我如何使用基于主机的认证?¶
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'] = [
'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 为什么认证窗口显示了很多次?¶
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 启动 phpMyAdmin 时可以在 URL 中使用哪些参数?¶
When starting phpMyAdmin, you can use the db
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.
For example, to jump directly to a particular database, a URL can be constructed as
https://example.com/phpmyadmin/?db=sakila
.
在 4.9.0 版更改: Support for using the pma_username
and pma_password
parameters was removed
in phpMyAdmin 4.9.0 (see PMASA-2019-4).
浏览器或客户端操作系统¶
5.1 当我尝试创建超过 14 个字段的表格时,我收到“内存用尽”警告,且操作失效。¶
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 使用 Xitami 2.5b4 时,phpMyAdmin 无法处理表单字段。¶
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 我通过 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’. The 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 由于 Internet Explorer 不存储 cookies,我无法使用 cookie 认证模式。¶
至少在第6版之前,微软的IE浏览器似乎真的对cookies很反感。
5.5 (withdrawn).¶
5.6 (withdrawn).¶
5.7 我刷新了浏览器,回到了欢迎页面。¶
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 (withdrawn).¶
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 浏览器将特殊字符替换为“?”。¶
This issue has been reported by a macOS user, who adds that Chimera, Netscape and Mozilla do not have this problem.
5.13 (withdrawn)¶
5.14 (withdrawn)¶
5.15 (withdrawn)¶
5.16 当使用 Internet Explorer 时,我收到”Access is denied” JavaScript 报错,或者我不能使 phpMyAdmin 在 Windows 下工作。¶
Please check the following points:
- Maybe you have defined your
$cfg['PmaAbsoluteUri']
setting inconfig.inc.php
to an IP address and you are starting phpMyAdmin with a URL containing a domain name, or the reverse situation. - Security settings in IE and/or Microsoft Security Center are too high, thus blocking scripts execution.
- The Windows Firewall is blocking Apache and MySQL. You must allow HTTP ports (80 or 443) and MySQL port (usually 3306) in the “in” and “out” directions.
5.17 无法使用 Firefox 删除数据或数据库。¶
Many users have confirmed that the Tabbrowser Extensions plugin they installed in their Firefox is causing the problem.
5.18 (withdrawn)¶
5.19 我的浏览器中出现 JavaScript 错误。¶
Issues have been reported with some combinations of browser extensions. To troubleshoot, disable all extensions then clear your browser cache to see if the problem goes away.
5.20 我收到“违反内容安全策略”的报错信息。¶
If you see errors like:
Refused to apply inline style because it violates the following Content Security Policy directive
This is usually caused by some software, which wrongly rewrites Content Security Policy headers. Usually this is caused by antivirus proxy or browser addons which are causing such errors.
If you see these errors, try disabling the HTTP proxy in antivirus or disable the Content Security Policy rewriting in it. If that doesn’t help, try disabling browser extensions.
Alternatively it can be also server configuration issue (if the webserver is configured to emit Content Security Policy headers, they can override the ones from phpMyAdmin).
Programs known to cause these kind of errors:
- Kaspersky Internet Security
5.21 I get errors about potentially unsafe operation when browsing table or executing SQL query.¶
If you see errors like:
A potentially unsafe operation has been detected in your request to this site.
This is usually caused by web application firewall doing requests filtering. It tries to prevent SQL injection, however phpMyAdmin is tool designed to execute SQL queries, thus it makes it unusable.
Please allow phpMyAdmin scripts from the web application firewall settings or disable it completely for phpMyAdmin path.
Programs known to cause these kind of errors:
- Wordfence Web Application Firewall
使用 phpMyAdmin¶
6.1 我不能在表中插入新行/我不能创建表-MySQL会出现SQL错误。¶
仔细检查:term:`SQL`错误。问题通常是由指定错误的列类型引起的。常见错误包括:
- 使用不带大小参数的
VARCHAR
- 使用携带大小参数的
TEXT
或BLOB
同时,请参考 MySQL 手册中语法一章确定你的语法都正确。
6.2 建表时,我给两个字段设置了索引,但 phpMyAdmin 却创建了一个包含这两个字段的索引。¶
这是一种创建多字段索引的方法。如果你需要两个索引,在建表时先设置一个,保存,然后显示数据表属性并点击索引链接来创建另一个索引。
6.3 怎样向我的表格中插入一个空 (null) 值?¶
自 2.2.3 版本起,每个字段都有一个复选框来设置字段是否为空。 2.2.3 版本之前,你只能输入 “null”,不包括引号来作为字段的值。自 2.5.5 版本起,你可以使用复选框来获得一个真正的空 (NULL) 值,如果你输入 “NULL” 将表示文字 NULL,而不是空 (NULL) 值 (对 PHP4 同样有效)。
6.4 怎样备份我的数据库或数据表?¶
Click on a database or table name in the navigation panel, 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 怎样通过转储恢复 (上传) 我的数据库或表?怎样运行一个 “.sql” 文件?¶
在导航面板中点击数据库名,将会显示它们的属性。在右边框架中的标签列表中选择 “导入”(如果你的 phpMyAdmin 版本低于 2.7.0,选择 SQL)。在 “文本文件的位置” 中输入你的转储文件名路径,或使用浏览按钮。然后点击执行。在 2.7.0 版本,导入引擎经过了重写,在可能的情况下会提示你更新以应用这些新特性。如果需要了解这些新特性,请在文档中查询“上传”一词。
Note: For errors while importing of dumps exported from older MySQL versions to newer MySQL versions, please check 6.41 从旧版 MySQL(5.7.6 版本之前)向新版 MySQL(5.7.7版本及更新)导入转储时,总会遇到导入错误,但是明明在向旧版本导入时没有任何问题啊?.
6.6 怎样在依例查询 (Query-by-example) 中使用关系表?¶
下面用数据库 “mydb” 中的数据表 persons、towns 和 countries 来举例。如果你没有 pma__relation
表,请先根据设置一节中的说明创建。然后创建示例表格:
CREATE TABLE REL_countries (
country_code char(1) NOT NULL default '',
description varchar(10) NOT NULL default '',
PRIMARY KEY (country_code)
) ENGINE=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)
) ENGINE=MyISAM;
INSERT INTO REL_persons VALUES (11, 'Marc', 'S', 'C');
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)
) ENGINE=MyISAM;
INSERT INTO REL_towns VALUES ('S', 'Sherbrooke');
INSERT INTO REL_towns VALUES ('M', 'Montréal');
设置对应连接并显示信息:
- 在表 “REL_persons” 上点击结构、关系查看
- for “town_code”, choose from dropdowns, “mydb”, “REL_towns”, “town_code” for foreign database, table and column respectively
- for “country_code”, choose from dropdowns, “mydb”, “REL_countries”, “country_code” for foreign database, table and column respectively
- 在表“REL_towns”上点击结构,然后点击关系查看
- in “Choose column to display”, choose “description”
- 在表 “REL_countries” 中重复以上两步
测试步骤如下:
- 在导航面板中点击你的数据库名
- 选择 “查询”
- 使用表: persons、towns、countries
- 点击 ”更新查询”
- 在字段行中,选择 persons.person_name 并选中 “显示” 复选框
- 为 towns.description 和 countries.descriptions 在另两列中重复上一步
- 点击“更新查询”你就能在查询框中看到已生成的 join 语句
- 点击 “提交查询”
6.7 怎样使用 “显示字段” 功能?¶
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
6.21 怎样才能在编辑/插入模式中看见某个字段基于外键表的可能的值的列表? for an additional feature that “display column”
enables: drop-down list of possible values.
6.8 怎样给我的数据库生成一份 PDF 大纲?¶
首先必须填入配置变量“relation”、“table_coords” 和 “pdf_pages”。
- 在导航面板中选择数据库。
- 在顶部导航条上点击 “Designer” 。
- 以需要的方式移动表格。
- 在左侧菜单中选择 “Export schema ”。
- 导出对话框会打开。
- 选择导出类型为 PDF,您可以调整其他设置。
- 一旦提交表单,文件就会开始下载。
参见
6.10 当创建权限时,如果数据库名称内带有下划线会发生什么?¶
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 数据统计页面中的符号 ø 是什么?¶
这是“平均值”的意思。
6.12 我想了解一些导出选项。¶
结构:
- “添加 DROP TABLE” 将会告诉 MySQL,如果在导入时已存在这张表则先 删除它 <https://dev.mysql.com/doc/refman/5.7/en/drop-table.html> _。它不会在导出之后删除你的表,而仅作用于导入的目标。
- “If Not Exists” 将仅创建不存在的数据表。 否则,当有一个同名但结构不同的数据表存在时就会出错。
- “添加 AUTO_INCREMENT 值” 保证 AUTO_INCREMENT 值 (如果有) 将包含在备份中。
- “给表名和字段名加上反引号” 保护名称中含有特殊字符或保留字的字段和表。
- “Add into comments” includes column comments, relations, and media types set in the pmadb in the dump as SQL comments (/* xxx */).
数据:
- “Complete inserts” adds the column names on every INSERT command, for better documentation (but resulting file is bigger).
- “Extended inserts” provides a shorter dump file by using only once the INSERT verb and the table name.
- “Delayed inserts” are best explained in the MySQL manual - INSERT DELAYED Syntax.
- “Ignore inserts” treats errors as a warning instead. Again, more info is provided in the MySQL manual - INSERT Syntax, but basically with this selected, invalid values are adjusted and inserted rather than causing the entire statement to fail.
6.13 我想创建一个名字里包含点的数据库。¶
这是个馊主意,因为在 MySQL 的语法中“database.table”是一个常见的引用指定数据库中表的用法。更糟糕的是,MySQL 通常会允许你创建这样一个数据库,但是你无法使用它,甚至无法删除它。
6.14 (withdrawn).¶
6.15 我想添加一个 BLOB 字段并索引它,但是 MySQL 说 “BLOB 列 ‘…’ 的主键定义不包含长度”。¶
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.).
6.17 Transformations: I can’t enter my own mimetype! What is this feature then useful for?¶
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 they can enter it at will?
6.18 书签:怎么保存书签?为什么我在查询框下找不到书签?变量有什么用?¶
You need to have configured the phpMyAdmin配置存储 for using bookmarks feature. Once you have done that, you can use bookmarks in the SQL tab.
参见
6.19 怎样创建一份包含导出表的简单的 LATEX 文档?¶
建立包含表的 TEX 文档很简单,最简单的例子如下所示(假设你将要把表导出到文件 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 我看到好多不属于我的数据库,而且我也无法访问它们。¶
这是因为你至少有下列全局权限之一:CREATE TEMPORARY TABLES 、SHOW DATABASES 和 LOCK TABLES,这些权限将允许用户看见所有的数据库名,如果你的用户不需要这些权限,你可以移除这些权限,这样他们所能看到的数据库列表就会减少。
6.21 怎样才能在编辑/插入模式中看见某个字段基于外键表的可能的值的列表?¶
你需要正确设置两张表之间的关系,同时还要在外键表设置 “显示字段” 。参见 6.6 怎样在依例查询 (Query-by-example) 中使用关系表? 中的例子。这时,如果外键表中有不超过 100 个值,就会出现一个下拉框。 你将会看到两个列表,第一个列表包含键和显示字段,第二个列表包含显示字段和键。这么做的目的是为了可以通过按下键或显示字段的首字母来定位。对于100个或更多值,将显示一个不同的窗口,以浏览外键值并选择一个。要更改默认限制100,请参阅 $cfg['ForeignKeyMaxLimit']
。
6.23 导出:phpMyAdmin 如何导出为 Microsoft Excel 文件?¶
You can use CSV for Microsoft Excel, which works out of the box.
在 3.4.5 版更改: Since phpMyAdmin 3.4.5 support for direct export to Microsoft Excel version 97 and newer was dropped.
6.24 现在 phpMyAdmin 支持了 MySQL 4.1.x 的字段注释,我原来在 phpMyAdmin 高级功能中保存在 pmadb 的字段注释会怎样?¶
它们将在你进入该表的结构页面时自动并入。
6.25 (withdrawn).¶
6.26 我怎么选择一些行?¶
先点击要选择的第一行,按住 Shift 键不放并点击最后一行。这在任何有行的地方都有效,例如浏览模式和结构页面。
6.27 我可以使用哪些格式字符串?¶
在所有 phpMyAdmin 接受格式字符串的地方,你都可以使用扩展 @VARIABLE@
和 strftime 格式字符串。扩展变量基于当前环境(例如,在你没有选中任何数据表时,你就无法获取表名),可以使用下列变量:
@HTTP_HOST@
- 运行 phpMyAdmin 的 HTTP 主机
@SERVER@
- MySQL 服务器名
@VERBOSE@
- 在
$cfg['Servers'][$i]['verbose']
中定义的详细的 MySQL 服务器名 @VSERVER@
- 如果设置了详细的 MySQL 服务器名则使用,否则使用常规的服务器名
@DATABASE@
- 当前打开的数据库
@TABLE@
- 当前打开的数据表
@COLUMNS@
- 当前打开表的字段
@PHPMYADMIN@
- 带版本号的 phpMyAdmin 字样
6.28 (withdrawn).¶
6.29 为什么我的查询结果不能显示为图表?¶
不是所有的表都能显示为图表。只有包含一个、两个或者三个字段的表才能通过图表表现出来。并且它还必须具有能令图表脚本理解的特定格式。当前所支持的格式可以在 图表 中找到。
6.30 导入:如何导入 ESRI Shapefiles?¶
An ESRI Shapefile is actually a set of several files, where .shp file contains geometry data and .dbf file contains data related to those geometry data. To read data from .dbf file you need to have PHP compiled with the dBase extension (–enable-dbase). Otherwise only geometry data will be imported.
为了上传这些文件,您可以使用以下任意一种方法:
Configure upload directory with $cfg['UploadDir']
, upload both .shp and .dbf files with
the same filename and chose the .shp file from the import page.
Create a zip archive with .shp and .dbf files and import it. For this
to work, you need to set $cfg['TempDir']
to a place where the web server user can
write (for example './tmp'
).
要在 UNIX 类系统下创建一个临时目录,可以通过:
cd phpMyAdmin
mkdir tmp
chmod o+rwx tmp
6.31 如何在设计器中创建关系?¶
To select relation, click: The display column is shown in pink. To set/unset a column as the display column, click the “Choose column to display” icon, then click on the appropriate column name.
6.32 如何使用 zoom 查找功能?¶
The Zoom search feature is an alternative to table search feature. It allows you to explore a table by representing its data in a scatter plot. You can locate this feature by selecting a table and clicking the Search tab. One of the sub-tabs in the Table Search page is Zoom Search.
Consider the table REL_persons in 6.6 怎样在依例查询 (Query-by-example) 中使用关系表? for an example. To use zoom search, two columns need to be selected, for example, id and town_code. The id values will be represented on one axis and town_code values on the other axis. Each row will be represented as a point in a scatter plot based on its id and town_code. You can include two additional search criteria apart from the two fields to display.
You can choose which field should be displayed as label for each point. If a display column has been set for the table (see 6.7 怎样使用 “显示字段” 功能?), it is taken as the label unless you specify otherwise. You can also select the maximum number of rows you want to be displayed in the plot by specifing it in the ‘Max rows to plot’ field. Once you have decided over your criteria, click ‘Go’ to display the plot.
After the plot is generated, you can use the mouse wheel to zoom in and out of the plot. In addition, panning feature is enabled to navigate through the plot. You can zoom-in to a certain level of detail and use panning to locate your area of interest. Clicking on a point opens a dialogue box, displaying field values of the data row represented by the point. You can edit the values if required and click on submit to issue an update query. Basic instructions on how to use can be viewed by clicking the ‘How to use?’ link located just above the plot.
6.33 浏览表格时,如何复制字段名?¶
Selecting the name of the column within the browse table header cell for copying is difficult, as the columns support reordering by dragging the header cells as well as sorting by clicking on the linked column name. To copy a column name, double-click on the empty area next to the column name, when the tooltip tells you to do so. This will show you an input box with the column name. You may right-click the column name within this input box to copy it to your clipboard.
6.34 如何使用表格收藏功能?¶
Favorite Tables feature is very much similar to Recent Tables feature. It allows you to add a shortcut for the frequently used tables of any database in the navigation panel . You can easily navigate to any table in the list by simply choosing it from the list. These tables are stored in your browser’s local storage if you have not configured your phpMyAdmin Configuration Storage. Otherwise these entries are stored in phpMyAdmin Configuration Storage.
IMPORTANT: In absence of phpMyAdmin Configuration Storage, your Favorite tables may be different in different browsers based on your different selections in them.
To add a table to Favorite list simply click on the Gray star in front of a table name in the list of tables of a Database and wait until it turns to Yellow. To remove a table from list, simply click on the Yellow star and wait until it turns Gray again.
Using $cfg['NumFavoriteTables']
in your config.inc.php
file, you can define the maximum number of favorite tables shown in the
navigation panel. Its default value is 10.
6.35 如何使用范围查找功能?¶
With the help of range search feature, one can specify a range of values for particular column(s) while performing search operation on a table from the Search tab.
To use this feature simply click on the BETWEEN or NOT BETWEEN operators from the operator select list in front of the column name. On choosing one of the above options, a dialog box will show up asking for the Minimum and Maximum value for that column. Only the specified range of values will be included in case of BETWEEN and excluded in case of NOT BETWEEN from the final results.
Note: The Range search feature will work only Numeric and Date data type columns.
6.36 什么是 Central 字段,我如何使用这个功能?¶
As the name suggests, the Central columns feature enables to maintain a central list of columns per database to avoid similar name for the same data element and bring consistency of data type for the same data element. You can use the central list of columns to add an element to any table structure in that database which will save from writing similar column name and column definition.
To add a column to central list, go to table structure page, check the columns you want to include and then simply click on “Add to central columns”. If you want to add all unique columns from more than one table from a database then go to database structure page, check the tables you want to include and then select “Add columns to central list”.
To remove a column from central list, go to Table structure page, check the columns you want to remove and then simply click on “Remove from central columns”. If you want to remove all columns from more than one tables from a database then go to database structure page, check the tables you want to include and then select “Remove columns from central list”.
To view and manage the central list, select the database you want to manage central columns for then from the top menu click on “Central columns”. You will be taken to a page where you will have options to edit, delete or add new columns to central list.
6.37 如何使用表结构优化功能?¶
Improve table structure feature helps to bring the table structure upto Third Normal Form. A wizard is presented to user which asks questions about the elements during the various steps for normalization and a new structure is proposed accordingly to bring the table into the First/Second/Third Normal form. On startup of the wizard, user gets to select upto what normal form they want to normalize the table structure.
Here is an example table which you can use to test all of the three First, Second and Third Normal Form.
CREATE TABLE `VetOffice` (
`petName` varchar(64) NOT NULL,
`petBreed` varchar(64) NOT NULL,
`petType` varchar(64) NOT NULL,
`petDOB` date NOT NULL,
`ownerLastName` varchar(64) NOT NULL,
`ownerFirstName` varchar(64) NOT NULL,
`ownerPhone1` int(12) NOT NULL,
`ownerPhone2` int(12) NOT NULL,
`ownerEmail` varchar(64) NOT NULL,
);
The above table is not in First normal Form as no primary key exists. Primary key is supposed to be (petName,`ownerLastName`,`ownerFirstName`) . If the primary key is chosen as suggested the resultant table won’t be in Second as well as Third Normal form as the following dependencies exists.
(OwnerLastName, OwnerFirstName) -> OwnerEmail
(OwnerLastName, OwnerFirstName) -> OwnerPhone
PetBreed -> PetType
Which says, OwnerEmail depends on OwnerLastName and OwnerFirstName. OwnerPhone depends on OwnerLastName and OwnerFirstName. PetType depends on PetBreed.
6.38 我如何重新分配自动增长的值?¶
Some users prefer their AUTO_INCREMENT values to be consecutive; this is not always the case after row deletion.
Here are the steps to accomplish this. These are manual steps because they involve a manual verification at one point.
- Ensure that you have exclusive access to the table to rearrange
- On your primary key column (i.e. id), remove the AUTO_INCREMENT setting
- Delete your primary key in Structure > indexes
- Create a new column future_id as primary key, AUTO_INCREMENT
- Browse your table and verify that the new increments correspond to what you’re expecting
- 删除掉旧的字段
- Rename the future_id column to id
- Move the new id column via Structure > Move columns
6.39 What is the “Adjust privileges” option when renaming, copying, or moving a database, table, column, or procedure?¶
When renaming/copying/moving a database/table/column/procedure, MySQL does not adjust the original privileges relating to these objects on its own. By selecting this option, phpMyAdmin will adjust the privilege table so that users have the same privileges on the new items.
For example: A user ‘bob’@’localhost’ has a ‘SELECT’ privilege on a column named ‘id’. Now, if this column is renamed to ‘id_new’, MySQL, on its own, would not adjust the column privileges to the new column name. phpMyAdmin can make this adjustment for you automatically.
注意:
- While adjusting privileges for a database, the privileges of all database-related elements (tables, columns and procedures) are also adjusted to the database’s new name.
- Similarly, while adjusting privileges for a table, the privileges of all the columns inside the new table are also adjusted.
- While adjusting privileges, the user performing the operation must have the following
privileges:
- SELECT, INSERT, UPDATE, DELETE privileges on following tables: mysql.`db`, mysql.`columns_priv`, mysql.`tables_priv`, mysql.`procs_priv`
- FLUSH privilege (GLOBAL)
Thus, if you want to replicate the database/table/column/procedure as it is while renaming/copying/moving these objects, make sure you have checked this option.
6.40 I see “Bind parameters” checkbox in the “SQL” page. How do I write parameterized SQL queries?¶
From version 4.5, phpMyAdmin allows users to execute parameterized queries in the “SQL” page. Parameters should be prefixed with a colon(:) and when the “Bind parameters” checkbox is checked these parameters will be identified and input fields for these parameters will be presented. Values entered in these field will be substituted in the query before being executed.
6.41 从旧版 MySQL(5.7.6 版本之前)向新版 MySQL(5.7.7版本及更新)导入转储时,总会遇到导入错误,但是明明在向旧版本导入时没有任何问题啊?¶
If you get errors like #1031 - Table storage engine for ‘table_name’ doesn’t have this option while importing the dumps exported from pre-5.7.7 MySQL servers into new MySQL server versions 5.7.7+, it might be because ROW_FORMAT=FIXED is not supported with InnoDB tables. Moreover, the value of innodb_strict_mode would define if this would be reported as a warning or as an error.
Since MySQL version 5.7.9, the default value for innodb_strict_mode is ON and thus would generate an error when such a CREATE TABLE or ALTER TABLE statement is encountered.
There are two ways of preventing such errors while importing:
- Change the value of innodb_strict_mode to OFF before starting the import and turn it ON after the import is successfully completed.
- This can be achieved in two ways:
- Go to ‘Variables’ page and edit the value of innodb_strict_mode
- Run the query : SET GLOBAL `innodb_strict_mode = ‘[value]’`
After the import is done, it is suggested that the value of innodb_strict_mode should be reset to the original value.
phpMyAdmin 项目¶
7.1 我发现了一处缺陷。怎样通知开发者?¶
Our issues tracker is located at <https://github.com/phpmyadmin/phpmyadmin/issues>. For security issues, please refer to the instructions at <https://www.phpmyadmin.net/security> to email the developers directly.
安全¶
8.1 哪里可以获取 phpMyAdmin 的安全警示信息?¶
8.2 怎样防止 phpMyAdmin 遭受暴力破解?¶
如果你使用 Apache 服务器,phpMyAdmin 会导出认证信息到 Apache 环境并可被 Apache 日志使用。目前有两个变量可用:
userID
- 当前活动用户的用户名(不需要在登录状态)。
userStatus
- 当前活动用户的状态,有
ok
(用户已登录)、mysql-denied
(MySQL 拒绝用户登录)、allow-denied
(用户被允许/禁止规则禁止)、root-denied
(root 用户登录在配置文件中被禁止)、empty-denied
(禁止空密码登录) 这几种状态。
可以像这样设置 Apache 的 LogFormat
指令:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %{userID}n %{userStatus}n" pma_combined
然后你可以使用任何日志分析工具来检测潜在的攻击。
8.3 为什么直接加载特定文件时会暴露路径?¶
这是服务器配置问题,永远不要在生产环境中启用 display_errors
。
8.4 phpMyAdmin导出的 CSV 文件可能会遭受公式注入攻击。¶
有可能生成一个 CSV 文件,当该文件被导入 Microsoft Excel 等电子表格程序时,有潜在可能允许执行任意命令。
The CSV files generated by phpMyAdmin could potentially contain text that would be interpreted by a spreadsheet program as a formula, but we do not believe escaping those fields is the proper behavior. There is no means to properly escape and differentiate between a desired text output and a formula that should be escaped, and CSV is a text format where function definitions should not be interpreted anyway. We have discussed this at length and feel it is the responsibility of the spreadsheet program to properly parse and sanitize such data on input instead.
Google 也有 类似的看法 。
开发者信息¶
phpMyAdmin是开放源码的,因此邀请您参与其中。其他人已经编写了许多伟大的特性,您也可以帮助使phpMyAdmin成为一个有用的工具。
您可以在 `官网的贡献章节<https://www.phpmyadmin.net/contribute/>`_ 查看所有贡献的可能途径。
安全策略¶
The phpMyAdmin developer team is putting lot of effort to make phpMyAdmin as secure as possible. But still web application like phpMyAdmin can be vulnerable to a number of attacks and new ways to exploit are still being explored.
For every reported vulnerability we issue a phpMyAdmin Security Announcement (PMASA) and it get’s assigned a CVE ID as well. We might group similar vulnerabilities to one PMASA (eg. multiple XSS vulnerabilities can be announced under one PMASA).
如果你认为找到了漏洞,请参阅 报告安全问题。
常见的漏洞¶
在这一小节中,我们会描述可能发生在我们代码仓库的典型的漏洞。这个列表并不完全,意在显示典型的攻击面。
跨站脚本攻击(XSS)¶
When phpMyAdmin shows a piece of user data, e.g. something inside a user’s database, all html special chars have to be escaped. When this escaping is missing somewhere a malicious user might fill a database with specially crafted content to trick an other user of that database into executing something. This could for example be a piece of JavaScript code that would do any number of nasty things.
phpMyAdmin tries to escape all userdata before it is rendered into html for the browser.
参见
维基百科上的`跨站点脚本 <https://en.wikipedia.org/wiki/Cross-site_scripting>`_
跨站请求伪造(CSRF)¶
An attacker would trick a phpMyAdmin user into clicking on a link to provoke some action in phpMyAdmin. This link could either be sent via email or some random website. If successful this the attacker would be able to perform some action with the users privileges.
To mitigate this phpMyAdmin requires a token to be sent on sensitive requests. The idea is that an attacker does not poses the currently valid token to include in the presented link.
每次登录都会重新生成令牌,所以它只在有限时间生效,攻击者难以合法获取。
SQL 注入¶
As the whole purpose of phpMyAdmin is to preform sql queries, this is not our first concern. SQL injection is sensitive to us though when it concerns the mysql control connection. This controlconnection can have additional privileges which the logged in user does not poses. E.g. access the phpMyAdmin配置存储.
User data that is included in (administrative) queries should always be run through DatabaseInterface::quoteString().
参见
暴力破解攻击¶
phpMyAdmin on its own does not rate limit authentication attempts in any way. This is caused by need to work in stateless environment, where there is no way to protect against such kind of things.
To mitigate this, you can use Captcha or utilize external tools such as fail2ban, this is more details described in 加固您的 phpMyAdmin 安装.
报告安全问题¶
Should you find a security issue in the phpMyAdmin programming code, please
contact the phpMyAdmin security team in
advance before publishing it. This way we can prepare a fix and release the fix together with your
announcement. You will be also given credit in our security announcement.
You can optionally encrypt your report with PGP key ID
DA68AB39218AB947
with following fingerprint:
pub 4096R/DA68AB39218AB947 2016-08-02
Key fingerprint = 5BAD 38CF B980 50B9 4BD7 FB5B DA68 AB39 218A B947
uid phpMyAdmin Security Team <security@phpmyadmin.net>
sub 4096R/5E4176FB497A31F7 2016-08-02
The key can be either obtained from the keyserver or is available in phpMyAdmin keyring available on our download server or using Keybase.
Should you have suggestion on improving phpMyAdmin to make it more secure, please report that to our issue tracker. Existing improvement suggestions can be found by hardening label.
分发和包装 phpMyAdmin¶
本篇文档的目的是给那些想在其他软件包中重新发布phpMyAdmin的人一些建议,比如Linux发行版或一些包括Web服务器和MySQL服务器的一体式软件包。
一般来说,你可以在 :file:`libraries/vendor_config.php`文件中做一些基本的自定义(一些文件的路径和行为)。
例如,如果你想让设置脚本在var文件夹中生成一个配置文件,那么将 SETUP_CONFIG_FILE
改为 /var/lib/phpmyadmin/config.inc.php
,你也可能想跳过目录可写检查,所以把 SETUP_DIR_WRITABLE
设定为false。
外部库¶
phpMyAdmin 包含了一些外部库,如果可能,你需要把他们换成系统提供的版本,但请注意需要对那个版本进行测试以保证兼容性。
目前已知外部库列表:
- js/vendor
- jQuery JavaScript 框架库及其他各种 JavaScript 库。
- vendor/
- 该下载包包括各种Composer软件包作为依赖。
特定文件许可证¶
phpMyAdmin distributed themes contain some content that is under licenses.
- Original 和 pmahomme 主题下的一些图标来自 Silk Icons 。
- Metro 主题下的一些图标来自 Silk Icons 。
- themes/*/img/b_rename.svg Is a Icons8, icon from the Android L Icon Pack Collection. The icon rename.
- themes/metro/img/user.svg Is a IcoMoon the user
CC BY 4.0 或 GPL 协议
供应商许可证¶
- Silk 图标由 CC BY 2.5 or CC BY 3.0 许可证授权。
- rename from Icons8 is under the “public domain” (CC0 1.0) license.
- IcoMoon Free is under “CC BY 4.0 or GPL”.
版权¶
Copyright (C) 1998-2000 Tobias Ratschiller <tobias_at_ratschiller.com>
Copyright (C) 2001-2018 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 版的许可下重新修改并/或发布。
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
您应该已经收到了GNU通用公共许可证的副本以及本程序。如果没有,请参阅<https://www.gnu.org/licenses/>。
第三方许可证¶
phpMyAdmin includes several third-party libraries which come under their respective licenses.
jQuery’s license, which is where we got the files under js/vendor/jquery/ is (MIT|GPL), a copy of each license is available in this repository (GPL is available as LICENSE, MIT as js/vendor/jquery/MIT-LICENSE.txt).
The download kit additionally includes several composer libraries. See their licensing information in the vendor/ directory.
鸣谢¶
鸣谢(按时间先后顺序)¶
- Tobias Ratschiller <tobias_at_ratschiller.com>
- phpMyAdmin 项目创始人
- 1998 至 2000 年夏季的主要维护人
- Marc Delisle <marc_at_infomarc.info>
- 在 1998 年 12月的多语言版本
- 许多修正和改进
- SQL 分析器的第一个版本(大部分)
- 2001 至 2015 年的维护者
- Olivier Müller <om_at_omnis.ch>
- 于 2001 年 3 月在 SourceForge 启动 phpMyAdmin 项目
- 同步新功能和缺陷修正到不同的 CVS
- 改进多语言,动态语言选择
- 许多缺陷修正和改进
- Loïc Chapeaux <lolo_at_phpheaven.net>
- 重写并优化 JavaScript,DHTML 和 DOM
- 重写脚本,使它们符合 PEAR 编码标准,并生成符合XHTML1.0和CSS2标准的代码
- 改进语言识别系统
- 许多缺陷修正和改进
- Robin Johnson <robbat2_at_users.sourceforge.net>
- Armel Fauveau <armel.fauveau_at_globalis-ms.com>
- 书签功能
- 多转储功能
- gzip 转储功能
- zip 转储功能
- Geert Lund <glund_at_silversoft.dk>
- 缺陷修正
- phpMyAdmin 早期在 phpwizard.net 的用户论坛版主
- Korakot Chaovavanich <korakot_at_iname.com>
- “插入新行”功能
- Pete Kelly <webmaster_at_trafficg.com>
- 重写并修复转储代码
- 缺陷修正
- Steve Alberty <alberty_at_neptunlabs.de>
- 重写 PHP4 的转储代码
- MySQL 数据表统计
- 缺陷修正
- Benjamin Gandon <gandon_at_isia.cma.fr>
- 2.1.0.1 版的主要作者
- 缺陷修正
- Alexander M. Turek <me_at_derrabus.de>
- MySQL 4.0 / 4.1 / 5.0 兼容
- 抽象数据库接口 (PMA_DBI) 及 MySQLi 支持
- 权限管理
- XML 导出
- 许多缺陷修正和改进
- 德语语言文件更新
- Mike Beck <mike.beck_at_web.de>
- 自动加入依例查询 (QBE)
- 打印预览中的字段链接
- 关联视图
- Michal Čihař <michal_at_cihar.com>
- 增强索引创建/显示功能
- 让 HTML 与 MySQL 使用不同的字符集
- 改进导出功能
- 许多缺陷修正和改进
- 捷克语语言文件更新
- 从 phpMyAdmin 创建当前网站
- 来自 “PHPMyAdmin的MySQL表单生成器” 的 Christophe Gesché (https://sourceforge.net/projects/phpmysqlformgen/)
- 多表打印预览补丁
- Garvin Hicking <me_at_supergarv.de>
- Yukihiro Kawada <kawada_at_den.fujifilm.co.jp>
- 日本汉字编码转换功能
- Piotr Roszatycki <d3xter_at_users.sourceforge.net> and Dan Wilson
- Cookie 认证功能
- Axel Sander <n8falke_at_users.sourceforge.net>
- 数据表关系连接功能
- Maxime Delorme <delorme.maxime_at_free.fr>
- PDF 大纲输出,同时感谢 Olivier Plathey 的 “FPDF” 库 (见 <http://www.fpdf.org/>) , Steven Wittens 的 “UFPDF” 库 和 Nicola Asuni 的 “TCPDF” 库 (see <https://tcpdf.org/>)。
- Olof Edlund <olof.edlund_at_upright.se>
- SQL 验证服务器
- Ivan R. Lanin <ivanlanin_at_users.sourceforge.net>
- phpMyAdmin logo (2004 年 6 月前)
- Mike Cochrane <mike_at_graftonhall.co.nz>
- Horde 项目的 blowfish 库 (在4.0版被取消)
- Marcel Tschopp <ne0x_at_users.sourceforge.net>
- mysqli 支持
- 许多缺陷修正和改进
- Nicola Asuni (Tecnick.com)
- TCPDF 库 (<https://tcpdf.org>)
- Michael Keck <mkkeck_at_users.sourceforge.net>
- 重新设计 2.6.0
- phpMyAdmin 帆船 logo (2004 年 6 月)
- Mathias Landhäußer
- 代表出席会议
- Sebastian Mendel <cybot_tm_at_users.sourceforge.net>
- 界面改进
- 许多缺陷修正
- Ivan A Kirillov
- 新的关系设计器
- Raj Kissu Rajandran (Google 代码之夏 2008)
- BLOB 流支持(4.0版取消)
- Piotr Przybylski (Google 编程之夏 2008,2010和2011)
- 改进安装脚本
- 用户偏好
- Drizzle支持
- Derek Schaefer (Google 代码之夏 2009)
- 改进导入功能
- Alexander Rutkowski (Google 代码之夏 2009)
- 结构追踪
- Zahra Naeem (Google 代码之夏 2009)
- 同步特性 (4.0版本后移除)
- Tomáš Srnka (Google 编程之夏 2009)
- 复制支持
- Muhammad Adnan (Google 代码之夏 2010)
- 导出关系大纲为多种格式
- Lori Lee (Google 代码之夏 2010)
- 用户界面改进
- ENUM/SET 编辑器
- 简化导入/导出界面
- Ninad Pundalik (Google 代码之夏 2010)
- 界面 AJAX 化
- Martynas Mickevičius (Google 代码之夏 2010)
- 图表
- Barrie Leslie
- 基于 PBMS PHP 扩展的 BLOB 流支持(4.0取消)
- Ankit Gupta (Google 代码之夏 2010)
- 可视化查询生成器
- Madhura Jayaratne (Google 编程之夏 2011)
- OpenGIS 支持
- Ammar Yasir (Google 编程之夏 2011)
- 缩放搜索
- Aris Feryanto (Google 代码之夏 2011)
- 浏览模式改善
- Thilanka Kaushalya (Google 代码之夏 2011)
- AJAX化
- Tyron Madlener (Google 代码之夏 2011)
- 状态页面的查询统计及图表
- Zarubin Stas (Google 代码之夏 2011)
- 自动化测试
- Rouslan Placella (Google 代码之夏 2011 和 2012)
- 改进了对存储例程,触发器和事件的支持
- 意大利语翻译更新
- 移除框架及新导航
- Dieter Adriaenssens
- 许多缺陷修正
- 荷兰语翻译更新
- Alex Marin (Google 编程之夏 2012)
- 新的插件和属性系统
- Thilina Buddika Abeyrathna (Google 编程之夏 2012)
- 重构
- Atul Pratap Singh (Google 编程之夏 2012)
- 重构
- Chanaka Indrajith (Google 编程之夏 2012)
- 重构
- Yasitha Pandithawatta (Google 编程之夏 2012)
- 自动化测试
- Jim Wigginton 吉姆·威金顿 (phpseclib.sourceforge.net)
- phpseclib
- Bin Zu (Google 编程之夏 2013)
- 重构
- Supun Nakandala (Google 编程之夏 2013)
- 重构
- Mohamed Ashraf (Google 编程之夏 2013)
- AJAX 错误报告
- Adam Kang (Google 编程之夏 2013)
- 自动化测试
- Ayush Chaudhary (Google 编程之夏 2013)
- 自动化测试
- Kasun Chathuranga (Google 编程之夏 2013)
- 界面改进
- Hugues Peccatte
- 按示例加载/保存查询 (数据库搜索书签)
- Smita Kumari (Google 编程之夏 2014)
- 中央列列表
- 改进表结构(规范化)
- Ashutosh Dhundhara (Google 编程之夏 2014)
- 界面改进
- Dhananjay Nakrani (Google 编程之夏 2014)
- PHP错误报告
- Edward Cheng (Google 编程之夏 2014)
- SQL 查询控制台
- Kankanamge Bimal Yashodha (Google 编程之夏 2014)
- 重构:设计器/模式集成
- Chirayu Chiripal (Google 编程之夏 2014)
- 自定义字段处理程序(基于输入的MIME转换)
- 导出表/列名称更改
- Dan Ungureanu (Google 编程之夏 2015)
- 新的解析器和分析器
- Nisarg Jhaveri (Google 编程之夏 2015)
- 页面相关设置
- SQL调试集成到控制台
- 其他UI改进
- Deven Bansod (Google 编程之夏 2015)
- 使用CSS打印视图
- 其他界面改进和新功能
- Deven Bansod (Google 编程之夏 2017)
- 错误报告服务器的改进
- 改进了Selenium测试
- Manish Bisht (Google 编程之夏 2017)
- 移动用户界面
- 删除内联JavaScript代码
- 其他UI改进
- Raghuram Vadapalli (Google 编程之夏 2017)
- 多表查询界面
- 允许Designer使用其他数据库中的表
- 其他UI改进
- Maurício Meneghini Fauth
- JavaScript核心的主要改进和升级
- 现代化JavaScript库功能
- 现代化模板并引入Twig
- William Desportes
- 基于PHPStan的编码风格改进
- 改进外部MySQL和MariaDB文档的链接
- 许多其他错误修复
- Emanuel Bronshtein
- 全面的安全评估和建议
- Lakshya Arora (Google 编程之夏 2018)
- 各种改进包括:
- 将用户首选项与本地存储集成
- 会话到期后使用模态登录
- 添加对CHECK CONSTRAINTS的支持
- 以及更多!
- 各种改进包括:
- Saksham Gupta (Google 编程之夏 2018)
- 自动主题生成器工具
- Leonardo Strozzi (Google 编程之夏 2018)
- 重构Twig模板和其他内部代码改进
- Piyush Vijay (Google 编程之夏 2018)
- 使JavaScript代码现代化,包括引入Webpack,Babel和Yarn以及eslint和Jsdoc
以及自 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”.
译者¶
以下人们为phpMyAdmin的翻译做出了贡献:
阿尔巴尼亚语
- Arben Çokaj <acokaj_at_shkoder.net>
阿拉伯语
- Ahmed Saleh Abd El-Raouf Ismae <a.saleh.ismael_at_gmail.com>
- Ahmed Saad <egbrave_at_hotmail.com>
- hassan mokhtari <persiste1_at_gmail.com>
亚美尼亚语
- Andrey Aleksanyants <aaleksanyants_at_yahoo.com>
阿塞拜疆语
- Mircəlal <01youknowme_at_gmail.com>
- Huseyn <huseyn_esgerov_at_mail.ru>
- Sevdimali İsa <sevdimaliisayev_at_mail.ru>
- Jafar <sharifov_at_programmer.net>
白俄罗斯语
- Viktar Palstsiuk <vipals_at_gmail.com>
保加利亚语
- Boyan Kehayov <bkehayov_at_gmail.com>
- Valter Georgiev <blagynchy_at_gmail.com>
- Valentin Mladenov <hudsonvsm_at_gmail.com>
- P <plamen_mbx_at_yahoo.com>
- krasimir <vip_at_krasio-valia.com>
加泰罗尼亚语
- josep constanti <jconstanti_at_yahoo.es>
- Xavier Navarro <xvnavarro_at_gmail.com>
中文 (简体)
- Vincent Lau <3092849_at_qq.com>
- Zheng Dan <clanboy_at_163.com>
- disorderman <disorderman_at_qq.com>
- Rex Lee <duguying2008_at_gmail.com>
- <fundawang_at_gmail.com>
- popcorner <memoword_at_163.com>
- Yizhou Qiang <qyz.yswy_at_hotmail.com>
- zz <tczzjin_at_gmail.com>
- Terry Weng <wengshiyu_at_gmail.com>
- whh <whhlcj_at_126.com>
中文 (繁体)
- Albert Song <albb0920_at_gmail.com>
- Chien Wei Lin <cwlin0416_at_gmail.com>
- Peter Dave Hello <xs910203_at_gmail.com>
科隆语
- Purodha <publi_at_web.de>
捷克语
- Aleš Hakl <ales_at_hakl.net>
- Dalibor Straka <dalibor.straka3_at_gmail.com>
- Martin Vidner <martin_at_vidner.net>
- Ondra Šimeček <ondrasek.simecek_at_gmail.com>
- Jan Palider <palider_at_seznam.cz>
- Petr Kateřiňák <petr.katerinak_at_gmail.com>
丹麦语
- Aputsiaĸ Niels Janussen <aj_at_isit.gl>
- Dennis Jakobsen <dennis.jakobsen_at_gmail.com>
- Jonas <jonas.den.smarte_at_gmail.com>
- Claus Svalekjaer <just.my.smtp.server_at_gmail.com>
荷兰语
- Voogt <a.voogt_at_hccnet.nl>
- dingo thirteen <dingo13_at_gmail.com>
- Robin van der Vliet <info_at_robinvandervliet.nl>
- Dieter Adriaenssens <ruleant_at_users.sourceforge.net>
- Niko Strijbol <strijbol.niko_at_gmail.com>
英语 (英国)
- Dries Verschuere <dries.verschuere_at_outlook.com>
- Francisco Rocha <j.francisco.o.rocha_at_zoho.com>
- Marc Delisle <marc_at_infomarc.info>
- Marek Tomaštík <tomastik.m_at_gmail.com>
世界语
- Eliovir <eliovir_at_gmail.com>
- Robin van der Vliet <info_at_robinvandervliet.nl>
爱沙尼亚语
- Kristjan Räts <kristjanrats_at_gmail.com>
芬兰语
- Juha Remes <jremes_at_outlook.com>
- Lari Oesch <lari_at_oesch.me>
法语
- Marc Delisle <marc_at_infomarc.info>
弗里斯兰语
- Robin van der Vliet <info_at_robinvandervliet.nl>
加利西亚语
- Xosé Calvo <xosecalvo_at_gmail.com>
德语
- Julian Ladisch <github.com-t3if_at_ladisch.de>
- Jan Erik Zassenhaus <jan.zassenhaus_at_jgerman.de>
- Lasse Goericke <lasse_at_mydom.de>
- Matthias Bluthardt <matthias_at_bluthardt.org>
- Michael Koch <michael.koch_at_enough.de>
- Ann + J.M. <phpMyAdmin_at_ZweiSteinSoft.de>
- <pma_at_sebastianmendel.de>
- Phillip Rohmberger <rohmberger_at_hotmail.de>
- Hauke Henningsen <sqrt_at_entless.org>
希腊语
- Παναγιώτης Παπάζογλου <papaz_p_at_yahoo.com>
希伯来语
- Moshe Harush <mmh15_at_windowslive.com>
- Yaron Shahrabani <sh.yaron_at_gmail.com>
- Eyal Visoker <visokereyal_at_gmail.com>
印地语
- Atul Pratap Singh <atulpratapsingh05_at_gmail.com>
- Yogeshwar <charanyogeshwar_at_gmail.com>
- Deven Bansod <devenbansod.bits_at_gmail.com>
- Kushagra Pandey <kushagra4296_at_gmail.com>
- Nisarg Jhaveri <nisargjhaveri_at_gmail.com>
- Roohan Kazi <roohan_cena_at_yahoo.co.in>
- Yugal Pantola <yug.scorpio_at_gmail.com>
匈牙利语
- Akos Eros <erosakos02_at_gmail.com>
- Dániel Tóth <leedermeister_at_gmail.com>
- Szász Attila <undernetangel_at_gmail.com>
- Balázs Úr <urbalazs_at_gmail.com>
印度尼西亚语
- Deky Arifianto <Deky40_at_gmail.com>
- Andika Triwidada <andika_at_gmail.com>
- Dadan Setia <da2n_s_at_yahoo.co.id>
- Dadan Setia <dadan.setia_at_gmail.com>
- Yohanes Edwin <edwin_at_yohanesedwin.com>
- Fadhiil Rachman <fadhiilrachman_at_gmail.com>
- Benny <tarzq28_at_gmail.com>
- Tommy Surbakti <tommy_at_surbakti.net>
- Zufar Fathi Suhardi <zufar.bogor_at_gmail.com>
国际语
- Giovanni Sora <g.sora_at_tiscali.it>
意大利语
- Francesco Saverio Giacobazzi <francesco.giacobazzi_at_ferrania.it>
- Marco Pozzato <ironpotts_at_gmail.com>
- Stefano Martinelli <stefano.ste.martinelli_at_gmail.com>
日语
- k725 <alexalex.kobayashi_at_gmail.com>
- Hiroshi Chiyokawa <hiroshi.chiyokawa_at_gmail.com>
- Masahiko HISAKAWA <orzkun_at_ageage.jp>
- worldwideskier <worldwideskier_at_yahoo.co.jp>
卡纳达语
- Robin van der Vliet <info_at_robinvandervliet.nl>
- Shameem Ahmed A Mulla <shameem.sam_at_gmail.com>
朝鲜语
- Bumsoo Kim <bskim45_at_gmail.com>
- Kyeong Su Shin <cdac1234_at_gmail.com>
- Dongyoung Kim <dckyoung_at_gmail.com>
- Myung-han Yu <greatymh_at_gmail.com>
- JongDeok <human.zion_at_gmail.com>
- Yong Kim <kim_at_nhn.com>
- 이경준 <kyungjun2_at_gmail.com>
- Seongki Shin <skshin_at_gmail.com>
- Yoon Bum-Jong <virusyoon_at_gmail.com>
- Koo Youngmin <youngminz.kr_at_gmail.com>
中库尔德(索拉尼)语
- Alan Hilal <alan.hilal94_at_gmail.com>
- Aso Naderi <aso.naderi_at_gmail.com>
- muhammad <esy_vb_at_yahoo.com>
- Zrng Abdulla <zhyarabdulla94_at_gmail.com>
拉脱维亚语
- Latvian TV <dnighttv_at_gmail.com>
- Edgars Neimanis <edgarsneims5092_at_inbox.lv>
- Ukko <perkontevs_at_gmail.com>
林堡语
- Robin van der Vliet <info_at_robinvandervliet.nl>
立陶宛语
- Vytautas Motuzas <v.motuzas_at_gmail.com>
马来西亚语
- Amir Hamzah <amir.overlord666_at_gmail.com>
- diprofinfiniti <anonynuine-999_at_yahoo.com>
尼泊尔语
- Nabin Ghimire <nnabinn_at_hotmail.com>
书面挪威语
- Børge Holm-Wennberg <borge947_at_gmail.com>
- Tor Stokkan <danorse_at_gmail.com>
- Espen Frøyshov <efroys_at_gmail.com>
- Kurt Eilertsen <kurt_at_kheds.com>
- Christoffer Haugom <ph3n1x.nobody_at_gmail.com>
- Sebastian <sebastian_at_sgundersen.com>
- Tomas <tomas_at_tomasruud.com>
波斯语
- ashkan shirian <ashkan.shirian_at_gmail.com>
- HM <goodlinuxuser_at_chmail.ir>
波兰语
- Andrzej <andrzej_at_kynu.pl>
- Przemo <info_at_opsbielany.waw.pl>
- Krystian Biesaga <krystian4842_at_gmail.com>
- Maciej Gryniuk <maciejka45_at_gmail.com>
- Michał VonFlynee <vonflynee_at_gmail.com>
葡萄牙语
- Alexandre Badalo <alexandre.badalo_at_sapo.pt>
- João Rodrigues <geral_at_jonilive.com>
- Pedro Ribeiro <p.m42.ribeiro_at_gmail.com>
- Sandro Amaral <sandro123iv_at_gmail.com>
葡萄牙(巴西)语
- Alex Rohleder <alexrohleder96_at_outlook.com>
- bruno mendax <brunomendax_at_gmail.com>
- Danilo GUia <danilo.eng_at_globomail.com>
- Douglas Rafael Morais Kollar <douglas.kollar_at_pg.df.gov.br>
- Douglas Eccker <douglaseccker_at_hotmail.com>
- Ed Jr <edjacobjunior_at_gmail.com>
- Guilherme Souza Silva <g.szsilva_at_gmail.com>
- Guilherme Seibt <gui_at_webseibt.net>
- Helder Santana <helder.bs.santana_at_gmail.com>
- Junior Zancan <jrzancan_at_hotmail.com>
- Luis <luis.eduardo.braschi_at_outlook.com>
- Marcos Algeri <malgeri_at_gmail.com>
- Marc Delisle <marc_at_infomarc.info>
- Renato Rodrigues de Lima Júnio <renatomdd_at_yahoo.com.br>
- Thiago Casotti <thiago.casotti_at_uol.com.br>
- Victor Laureano <victor.laureano_at_gmail.com>
- Vinícius Araújo <vinipitta_at_gmail.com>
- Washington Bruno Rodrigues Cav <washingtonbruno_at_msn.com>
- Yan Gabriel <yansilvagabriel_at_gmail.com>
旁遮普语
- Robin van der Vliet <info_at_robinvandervliet.nl>
罗马尼亚语
- Alex <amihaita_at_yahoo.com>
- Costel Cocerhan <costa1988sv_at_gmail.com>
- Ion Adrian-Ionut <john_at_panevo.ro>
- Raul Molnar <molnar.raul_at_wservices.eu>
- Deleted User <noreply_at_weblate.org>
- Stefan Murariu <stefan.murariu_at_yahoo.com>
俄语
- Andrey Aleksanyants <aaleksanyants_at_yahoo.com>
- <ddrmoscow_at_gmail.com>
- Robin van der Vliet <info_at_robinvandervliet.nl>
- Хомутов Иван Сергеевич <khomutov.ivan_at_mail.ru>
- Alexey Rubinov <orion1979_at_yandex.ru>
- Олег Карпов <salvadoporjc_at_gmail.com>
- Egorov Artyom <unlucky_at_inbox.ru>
塞尔维亚语
- Smart Kid <kidsmart33_at_gmail.com>
僧伽罗语
- Madhura Jayaratne <madhura.cj_at_gmail.com>
斯洛伐克语
- Martin Lacina <martin_at_whistler.sk>
- Patrik Kollmann <parkourpotex_at_gmail.com>
- Jozef Pistej <pistej2_at_gmail.com>
斯洛文尼亚语
- Domen <mitenem_at_outlook.com>
西班牙语
- Daniel Hinostroza, MD <phpmyadmin_at_cerebroperiferico.com>
- Luis García Sevillano <floss.dev_at_gmail.com>
- Franco <fulanodetal.github1_at_openaliasbox.org>
- Luis Ruiz <luisan00_at_hotmail.com>
- Macofe <macofe.languagetool_at_gmail.com>
- Matías Bellone <matiasbellone+weblate_at_gmail.com>
- Rodrigo A. <ra4_at_openmailbox.org>
- FAMMA TV NOTICIAS MEDIOS DE CO <revistafammatvmusic.oficial_at_gmail.com>
- Ronnie Simon <ronniesimonf_at_gmail.com>
瑞典语
- Anders Jonsson <anders.jonsson_at_norsjovallen.se>
泰米尔语
- கணேஷ் குமார் <GANESHTHEONE_at_gmail.com>
- Achchuthan Yogarajah <achch1990_at_gmail.com>
- Rifthy Ahmed <rifthy456_at_gmail.com>
泰语
- <nontawat39_at_gmail.com>
- Somthanat W. <somthanat_at_gmail.com>
土耳其语
- Burak Yavuz <hitowerdigit_at_hotmail.com>
乌克兰语
- Сергій Педько <nitrotoll_at_gmail.com>
- Igor <vmta_at_yahoo.com>
- Vitaliy Perekupka <vperekupka_at_gmail.com>
越南语
- Bao Phan <baophan94_at_icloud.com>
- Xuan Hung <mr.hungdx_at_gmail.com>
- Bao trinh minh <trinhminhbao_at_gmail.com>
西佛兰德语
- Robin van der Vliet <info_at_robinvandervliet.nl>
文档译者¶
下面是对phpMyAdmin文档翻译工作做出贡献的人:
阿尔巴尼亚语
- Arben Çokaj <acokaj_at_shkoder.net>
阿拉伯语
- Ahmed El Azzabi <ahmedtek1993_at_gmail.com>
- Omar Essam <omar_2412_at_live.com>
亚美尼亚语
- Andrey Aleksanyants <aaleksanyants_at_yahoo.com>
阿塞拜疆语
- Mircəlal <01youknowme_at_gmail.com>
- Sevdimali İsa <sevdimaliisayev_at_mail.ru>
加泰罗尼亚语
- josep constanti <jconstanti_at_yahoo.es>
- Joan Montané <joan_at_montane.cat>
- Xavier Navarro <xvnavarro_at_gmail.com>
中文 (简体)
- Vincent Lau <3092849_at_qq.com>
- 罗攀登 <6375lpd_at_gmail.com>
- disorderman <disorderman_at_qq.com>
- ITXiaoPang <djh1017555_at_126.com>
- tunnel213 <tunnel213_at_aliyun.com>
- Terry Weng <wengshiyu_at_gmail.com>
- whh <whhlcj_at_126.com>
中文 (繁体)
- Chien Wei Lin <cwlin0416_at_gmail.com>
- Peter Dave Hello <xs910203_at_gmail.com>
捷克语
- Aleš Hakl <ales_at_hakl.net>
- Michal Čihař <michal_at_cihar.com>
- Jan Palider <palider_at_seznam.cz>
- Petr Kateřiňák <petr.katerinak_at_gmail.com>
丹麦语
- Aputsiaĸ Niels Janussen <aj_at_isit.gl>
- Claus Svalekjaer <just.my.smtp.server_at_gmail.com>
荷兰语
- Voogt <a.voogt_at_hccnet.nl>
- dingo thirteen <dingo13_at_gmail.com>
- Dries Verschuere <dries.verschuere_at_outlook.com>
- Robin van der Vliet <info_at_robinvandervliet.nl>
- Stefan Koolen <nast3zz_at_gmail.com>
- Ray Borggreve <ray_at_datahuis.net>
- Dieter Adriaenssens <ruleant_at_users.sourceforge.net>
- Tom Hofman <tom.hofman_at_gmail.com>
爱沙尼亚语
- Kristjan Räts <kristjanrats_at_gmail.com>
芬兰语
- Juha <jremes_at_outlook.com>
法语
- Cédric Corazza <cedric.corazza_at_wanadoo.fr>
- Étienne Gilli <etienne.gilli_at_gmail.com>
- Marc Delisle <marc_at_infomarc.info>
- Donavan_Martin <mart.donavan_at_hotmail.com>
弗里斯兰语
- Robin van der Vliet <info_at_robinvandervliet.nl>
加利西亚语
- Xosé Calvo <xosecalvo_at_gmail.com>
德语
- Daniel <d.gnauk89_at_googlemail.com>
- JH M <janhenrikm_at_yahoo.de>
- Lasse Goericke <lasse_at_mydom.de>
- Michael Koch <michael.koch_at_enough.de>
- Ann + J.M. <phpMyAdmin_at_ZweiSteinSoft.de>
- Niemand Jedermann <predatorix_at_web.de>
- Phillip Rohmberger <rohmberger_at_hotmail.de>
- Hauke Henningsen <sqrt_at_entless.org>
希腊语
- Παναγιώτης Παπάζογλου <papaz_p_at_yahoo.com>
匈牙利语
- Balázs Úr <urbalazs_at_gmail.com>
意大利语
- Francesco Saverio Giacobazzi <francesco.giacobazzi_at_ferrania.it>
- Marco Pozzato <ironpotts_at_gmail.com>
- Stefano Martinelli <stefano.ste.martinelli_at_gmail.com>
- TWS <tablettws_at_gmail.com>
日语
- Eshin Kunishima <ek_at_luna.miko.im>
- Hiroshi Chiyokawa <hiroshi.chiyokawa_at_gmail.com>
立陶宛语
- Jur Kis <atvejis_at_gmail.com>
- Dovydas <dovy.buz_at_gmail.com>
书面挪威语
- Tor Stokkan <danorse_at_gmail.com>
- Kurt Eilertsen <kurt_at_kheds.com>
葡萄牙(巴西)语
- Alexandre Moretti <alemoretti2010_at_hotmail.com>
- Douglas Rafael Morais Kollar <douglas.kollar_at_pg.df.gov.br>
- Guilherme Seibt <gui_at_webseibt.net>
- Helder Santana <helder.bs.santana_at_gmail.com>
- Michal Čihař <michal_at_cihar.com>
- Michel Souza <michel.ekio_at_gmail.com>
- Danilo Azevedo <mrdaniloazevedo_at_gmail.com>
- Thiago Casotti <thiago.casotti_at_uol.com.br>
- Vinícius Araújo <vinipitta_at_gmail.com>
- Yan Gabriel <yansilvagabriel_at_gmail.com>
斯洛伐克语
- Martin Lacina <martin_at_whistler.sk>
- Michal Čihař <michal_at_cihar.com>
- Jozef Pistej <pistej2_at_gmail.com>
斯洛文尼亚语
- Domen <mitenem_at_outlook.com>
西班牙语
- Luis García Sevillano <floss.dev_at_gmail.com>
- Franco <fulanodetal.github1_at_openaliasbox.org>
- Matías Bellone <matiasbellone+weblate_at_gmail.com>
- Ronnie Simon <ronniesimonf_at_gmail.com>
土耳其语
- Burak Yavuz <hitowerdigit_at_hotmail.com>
版本 2.1.0 的鸣谢原文¶
此项目基于 Peter Kuppelwieser 的 MySQL-Webadmin 而来。他想出了通过 PHP3 来建立一个基于 web 的 MySQL 交互界面这个点子。尽管我没有使用他的源代码,但很多想法都是受他而启发。我之所以启动 phpMyAdmin 这个项目是因为 Peter 告诉我他不再开发他 (优秀) 的工具了。
在这里要感谢
- Amalesh Kempf <ak-lsml_at_living-source.com> 贡献了检查是否正在删除数据表或数据库的代码。同时他建议在 tbl_create.php3 中应该可以让用户设置主键。在 1.1.1 版本中他贡献了 ldi_*.php3-set (导入文本文件) 、缺陷报告以及许多小改进。
- Jan Legenhausen <jan_at_nrw.net>: 他对 1.3.0 中引进的功能作出许多改进 (包括诸如认证这样的重要功能)。他还增强了 1.4.1 中的数据表转储功能。以及缺陷修正及帮助。
- Marc Delisle <DelislMa_at_CollegeSherbrooke.qc.ca> 通过使用单独的语言文件使 phpMyAdmin 实现语言分离。他也对法语翻译作出了贡献。
- Alexandr Bravo <abravo_at_hq.admiral.ru> 贡献了 tbl_select.php3,一种可以只显示一张表中的某些字段的功能。
- Chris Jackson <chrisj_at_ctel.net> 在 tbl_change.php3 中添加了对 MySQL 函数的支持。在 2.0 中添加了 “依例查询” 功能。
- Dave Walton <walton_at_nordicdms.com> 添加了多服务器的支持并且经常贡献缺陷修正。
- Gabriel Ash <ga244_at_is8.nyu.edu> 贡献了 2.0.6 中的随机访问功能。
感谢下列对小的修改、改进、缺陷修正以及新语言支持作出贡献的人们:
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.
同时感谢所有给我们提出建议、意见、报告缺陷以及使用反馈的热心用户。
词汇表¶
源自维基百科,自由的百科全书
- .htaccess
Apache 的目录级配置文件默认文件名。
- ACL
- 访问控制列表
- Blowfish
由 Bruce Schneier 于 1993 年设计的一种分组对称加密算法。
- 浏览器
一个可以让用户通过万维网上网站的网页中的文字、图片或其他信息交互的软件。
- Bzip2
一个由 Julian Seward 开发的自由软件、开源数据压缩算法。
- CGI
一种可以让客户端浏览器向网站服务器上运行的程序请求数据的重要技术。
- Changelog
记录项目改变的日志或记录。
- 客户端
通过某种网络访问另一台计算机上的(远程)服务的计算机系统。
- 字段
具有一个特定的简单类型,数据表中的每一条数据都有一个该类型的值。
服务器向浏览器发送的一些信息,浏览器在每次访问对应的服务器时会将这些信息返回。
- CSV
用逗号分隔的值
- DB
- 参见:Database
- 数据库
一个有组织的数据集合。
- 引擎
- 参见 Storage Engines
- PHP 扩展
PHP 扩展是为 PHP 提供附加功能的模块。
- FAQ
常见问题(Frequently Asked Questions,FAQ)是指一些经常被问到的问题及回答。
- 字段
一部分分开的数据或列。
- 外键
a column or group of columns in a database row that points to a key column or group of columns forming a key of another database row in some (usually different) table.
- GD
由 Thomas Boutell 等人为动态处理图像所开发的库。
- GD2
- 参见:GD
- GZip
GZip 是 GNU zip 的缩写,一个 GNU 自由软件,文件压缩程序。
- 主机
任何连接到计算机网络中的机器,每个节点都有一个主机名。
- 主机名
主机名是用于其他设备识别,网络中设备的唯一名称。
- HTTP
超文本传输协议(HyperText Transfer Protocol,HTTP)是传递万维网上信息的主要方法。
- HTTPS
HTTPS 是附加了安全措施的 HTTP 连接。
- IEC
- 国际电工委员会
- IIS
微软 Windows 服务器所使用的互联网服务。
- 索引
一种允许快速访问表格行的特征。
- IP
IP(互联网协议 (Internet Protocol))是一种通过数据包交换在来源与目标主机之间通信的面向数据的协议。
- IP 地址
IP 地址是利用互联网协议标准用来标识设备及与其他设备通信的唯一号码。
- IPv6
IPv6(互联网协议版本 6)是互联网协议( IP)的最新版本,为 IPv4 地址长期存在的地址短缺问题而设计。
- ISAPI
ISAPI(互联网服务器应用程序接口 (Internet Server Application Programming Interface))是 Internet 信息服务 (IIS) 的应用程序接口。
- ISP
ISP(互联网服务提供商 (Internet service provider))是为用户提供访问互联网及相关服务的公司或组织。
- ISO
国际标准化组织
参见
- JPEG
JPEG 是一种最常用的有损压缩图像的标准方法。
- JPG
- 参阅 JPEG
- 键值
- 参见:Index
- LaTeX
一个用于 Tex 排版程序的文档系统。
- Mac
苹果计算机公司所设计、开发、制造及销售的个人计算机。
- macOS
macOS 是苹果公司为 Mac 所开发的操作系统,该操作系统包括在所有目前在消费者和专业市场出货的苹果 Macintosh 电脑中。
- mbstring
PHP mbstring 函数提供了多字节字符集语言的支持,特别是 UTF-8。
如果你在安装此扩展时出现问题,请参考 1.20 我收到丢失 mysqli 和 mysql 扩展的报错。,它提供了有用的建议。
- 媒体类型
A media type (formerly known as MIME type) is a two-part identifier for file formats and format contents transmitted on the Internet.
- MIME
MIME(多用途互联网邮件扩展 (Multipurpose Internet Mail Extensions))是一种定义电子邮件格式的互联网标准。
- 模块
Apache 网站服务器的一些模块扩展。
- mod_proxy_fcgi
一个实现快速 CGI 接口的 Apache 模块;PHP 可以作为 CGI 模块、FastCGI 或直接作为 Apache 模块运行。
- MySQL
一个多线程、多用户的 SQL(结构化查询语言 (Structured Query Language))数据库管理系统 (DBMS) 。
- MySQLi
改进的 MySQL 客户端,PHP 扩展。
- mysql
mysql 是 MySQL 客户端的 PHP 扩展。
- OpenDocument
一种 office 文档的开放标准。
- OS X
参见:macOS 。
PDF(便携式文档格式 (Portable Document Format))是 一种由 Adobe 公司为二维文档所开发的设备无关和清晰度无关的文件格式。
- PEAR
PHP 扩展和应用程序库。
参见
参见
- PCRE
PHP 所用的 Perl 兼容正则表达式的函数
- PHP
“PHP: 超文本预处理器 (PHP: Hypertext Preprocessor)” 的缩写,近来被广泛用来开发服务器端应用程序以及动态网站的开源编程语言。
- 端口
通过端口连接,可以发送和接收数据。
- 主键
A primary key is an index over one or more fields in a table with unique values for every single row in this table. Every table should have a primary key for easier accessing/identifying data in this table. There can only be one primary key per table and it is named always PRIMARY. In fact, a primary key is just an unique key with the name PRIMARY. If no primary key is defined MySQL will use first unique key as primary key if there is one.
You can create the primary key when creating the table (in phpMyAdmin just check the primary key radio buttons for each field you wish to be part of the primary key).
You can also add a primary key to an existing table with ALTER TABLE or CREATE INDEX (in phpMyAdmin you can just click on ‘add index’ on the table structure page below the listed fields).
- RFC
请求注释(Request for Comments,RFC)是一系列围绕互联网技术关于新研究、方法及方法可行性的文档。
- RFC 1952
GZIP file format specification version 4.3
参见
- 行(记录,元组)
代表数据表中单一的、隐式结构化的数据项。
- 服务器
一个向网络中其他计算机系统提供服务的计算机系统。
- Sodium
PHP Sodium 扩展。
- 存储引擎
MySQL can use several different formats for storing data on disk, these are called storage engines or table types. phpMyAdmin allows a user to change their storage engine for a particular table through the operations tab.
Common table types are InnoDB and MyISAM, though many others exist and may be desirable in some situations.
参见
`MySQL文档关于替代存储引擎的章节 <https://dev.mysql.com/doc/refman/8.0/en/storage-engines.html> `_
- socket
一种内部通信的形式。
- SSL
安全套接层(Secure Sockets Layer,SSL)是一种为互联网通信提供安全的加密协议,现在被 TLS 取代。
- 存储过程
一个可用于访问关系数据库系统的应用程序的子程序
- SQL
结构化查询语言
- 表格
一组数据元素(单元),被组织、定义和存储为水平行和垂直列,其中每个项目可以通过标签或键或其与其他项目的位置来唯一地识别。
- tar
一种档案文件格式:磁带 (Tape) 档案 (ARchive) 格式。
- TCP
传输控制协议(Transmission Control Protocol,TCP)是互联网协议套件的核心协议之一。
- TCPDF
用于生成 PDF 文件的 PHP 库。
参见
- 触发器
触发器是响应数据库中特定表格或视图上的某些事件而自动执行的程序代码
- 唯一键
- 唯一键是一个表内一个或多个字段的索引,它对每一行都有一个唯一的值。 如果没有定义 primary key ,第一个唯一键将被视为*主键*。
- URL
一个用来指明互联网上文档、图像等资源的位置,符合标准格式的字符串。
- 网站服务器
网站服务器是可以接受并响应客户端发起的 HTTP 请求,提供网页服务的计算机(程序)。
- XML
可扩展标记语言(Extensible Markup Language,XML)是 W3C 推荐用来创建可以描述不同类型数据的特殊标记语言的通用标记语言。
- ZIP
一种流行的数据压缩和存档格式。
- Zlib
一种由 Jean-loup Gailly 和 Mark Adler. 开发的开源、跨平台的数据压缩库。
- 内容安全策略
HTTP Content-Security-Policy 响应头允许网站管理员控制允许用户代理为特定页面加载的资源。