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 生成、 转换关系 等),您需要创建一系列特殊的表。 这些表可以放在您自己的数据库里,也可以在一个多用户的服务器上创建一个独立的中心数据库(该数据库将通过其对应的帐号访问,所以不应给其他用户访问该数据库的权限)。

Zero configuration

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.

Manual configuration

您可以在 ./sql/ 文件夹中找到 create_tables.sql 文件。(若您使用 Windows 服务器,请特别注意 1.23 I’m running MySQL on a Win32 machine. Each time I create a new table the table and column names are changed to lowercase!)。

If you already had this infrastructure and:

  • upgraded to MySQL 4.1.2 or newer, please use sql/upgrade_tables_mysql_4_1_2+.sql.
  • upgraded to phpMyAdmin 4.3.0 or newer from 2.5.0 or newer (<= 4.2.x), please use sql/upgrade_column_info_4_3_0+.sql.
  • upgraded to phpMyAdmin 4.7.0 or newer from 4.3.0 or newer, please use sql/upgrade_tables_4_7_0+.sql.

and then create new tables by importing sql/create_tables.sql.

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

在导入 sql/create_tables.sql 文件之后,您还需要在 config.inc.php 文件中设置表名。您可以在 设置 一节中找到相应的指令。

You will also need to have a controluser ($cfg['Servers'][$i]['controluser'] and $cfg['Servers'][$i]['controlpass'] settings) with the proper rights to those tables. For example you can create it using following statement:

And for any MariaDB version:

  1. CREATE USER 'pma'@'localhost' IDENTIFIED VIA mysql_native_password USING 'pmapass';
  2. GRANT SELECT, INSERT, UPDATE, DELETE ON `<pma_db>`.* TO 'pma'@'localhost';

For MySQL 8.0 and newer:

  1. CREATE USER 'pma'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'pmapass';
  2. GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost';

For MySQL older than 8.0:

  1. CREATE USER 'pma'@'localhost' IDENTIFIED WITH mysql_native_password AS 'pmapass';
  2. 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 I get an error message about unknown authentication method caching_sha2_password when trying to log in for details.