如何启用 phpMyAdmin 的 Designer 视图?

2022-08-30 14:36:34

我正在本地运行phpMyAdmin,我正在尝试启用设计器工具。

Screenshot of phpMyAdmin's Designer view

如何为phpMyAdmin启用设计器视图?

我已经阅读了很多关于如何为phpMyAdmin启用设计器视图的教程,它们都有不同的方向,似乎从未真正让它工作。

我使用的是版本 4.0.7


答案 1

以下步骤将在phpMyAdmin 4 +中启用设计器,假设phpMyAdmin位于该文件夹中:phpMyAdmin

  • 打开和。phpMyAdmin/config.inc.phpphpMyAdmin/config.sample.inc.php
  • 在(4.0.7 中的第 38-66 行)中找到 phpMyAdmin 配置存储设置。config.sample.inc.php
  • 复制所有控制用户和存储 db/表配置并将其粘贴到 中。完成后,您的config.inc.php应包含如下内容:config.inc.php

4.0.7 示例:

/* change this info to whatever user has read-only access to the "mysql/user" and "mysql/db" tables */          
$cfg['Servers'][$i]['controluser']   = 'root'; //this is the default user for MAMP's mysql
$cfg['Servers'][$i]['controlpass']   = 'root'; //this is the default password for MAMP's mysql

/* this information needs to line up with the database we're about to create so don't edit it unless you plan on editing the SQL we're about to run */
$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]['designer_coords'] = 'pma__designer_coords';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';

注意:我们只是告诉phpMyAdmin在什么数据库和表名称上存储特定的配置详细信息。现在,让我们添加数据库。

  • phpMyAdmin 使用 SQL 进行安装,我们需要生成设计器所依赖的数据库。我们只需要找到脚本。在 4.0.7 中,文件位置为 。或者,您可以从phpMyAdmin的github复制/下载它。phpMyAdmin/examples/create_tables.sql
  • 找到文件后,导入文件或将其复制/粘贴到SQL窗口中并在phpMyAdmin中执行。
  • 现在,一切都应该正确配置。我们需要清除 Cookie 并重新启动浏览器。
  • 当您打开phpMyAdmin备份时,导航到特定表,在选项卡中,您应该看到设计器选项卡。

免责声明:这些说明专门基于phpMyAdmin 4 +中的新文件夹结构。您可以使用phpMyAdmin的github config.sample.php和随附的create-table.sql来应用相同的方向。通过选择正确的分支来选择您的phpMyAdmin版本。


答案 2

如果您只是遵循其他答案,可能会令人困惑。是的,您需要按照说明更改配置,但此配置是指具有特殊权限的MySQL用户。这里对此进行了解释:https://wiki.phpmyadmin.net/pma/controluser 在关于pmadb功能的部分下。因此,有两个步骤:(从链接页面复制粘贴)

  1. 在 mysql 中:

    在 phpmyadmin 上授予 SELECT, INSERT, UPDATE, DELETE.* TO 'pma'@'localhost';

  2. 在 ./config.inc.php:

    $cfg['Servers'][$i]['controluser'] = 'pma';在这里使用上面创建的任何用户名 $cfg['Servers'][$i]['controlpass'] = 'pmapass';在此处使用密码以匹配该用户


推荐