31

I am running phpMyAdmin locally and I am trying to enable the Designer tool.

Screenshot of phpMyAdmin's Designer view

How do you enable designer view for phpMyAdmin?

I have read quite a few tutorials on how to enable the Designer view for phpMyAdmin and they all have different directions that never seem to actually get it working.

I am using version 4.0.7

4

4 回答 4

43

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

  • 打开phpMyAdmin/config.inc.phpphpMyAdmin/config.sample.inc.php
  • config.sample.inc.php在(4.0.7 中的第 38-66 行)中找到 phpMyAdmin 配置存储设置。
  • 复制所有控制用户和存储 db/table 配置并将其粘贴到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 安装了我们需要生成 Designer 所依赖的数据库的 SQL。我们只需要找到脚本。在 4.0.7 中,文件位置是phpMyAdmin/examples/create_tables.sql. 或者,您可以从phpMyAdmin 的 github复制/下载它。
  • 找到文件后,导入文件或将其复制/粘贴到 SQL 窗口中并在 phpMyAdmin 中执行。
  • 现在,一切都应该正确配置。我们需要清除 cookie 并重新启动浏览器。
  • 当您打开 phpMyAdmin 备份时,导航到特定表,在选项卡中您应该会看到 Designer 选项卡。

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

于 2013-10-03T18:38:22.703 回答
1

对于 Debian Jessie,8.6 w/phpMyAdmin 4:4.2.12-2+deb8u2 这是我解决这个问题的方法:

我知道这涉及很多。显然安装程序有问题,但我不知道从哪里开始修复它。所以这是目前的解决方法。似乎有很多人遇到了这个问题,而且似乎有多种解决方案可以在不同的版本下工作。


0) 正如 这里的 Debian 设置说明中所建议的,我首先这样做了。它没有解决问题,但它可能有所帮助。它会重新询问您问题,并且 -p low 参数确保询问所有问题:

dpkg-reconfigure -plow phpmyadmin

它说“它创建了一个 phpmyadmin 数据库”(它是表),但它没有,所以我们将在下面手动创建它们。


1) 通过在您的浏览器中输入这个来运行 phpMyAdmin,(您需要在您的网络服务器中启用 PHP 支持)。您需要 MariaDB 或 MySQL 服务器的用户名和密码。通常用户名是root。对我来说,服务器是本地的,所以我的服务器选择是 localhost:

 http://localhost/phpmyadmin/

2) 解压 /usr/share/doc/phpmyadmin/examples/create_tables.sql.gz 并解压 SQL。 我不得不使用编辑器删除以“--”开头的注释行。

((注意我认为这个存档可能暂时损坏,因为当我尝试手动解压缩它时会出错。但是你可以使用这个技巧来打开它:

 dd if=create_tables.sql.gz  | gunzip -f 

GUI 'Open With Archive Manager' 也让我打开它。

3) 选择 SQL 选项卡,将此 sql 从 #2 粘贴到 SQL 框中,然后单击“Go”以创建数据库和表。(假设在 /etc/phpmyadmin/sql/create_tables.sql 中缺少的 SQL。)

4) 创建名为“pma”的 sql 用户。 打开 phpMyAdmin,选择主页 | 用户 | 添加用户,并添加一个名为“pma”的新用户,如下所示:

User name: Use text field: pma 
Host: Local: localhost 
Password: Use text field: <enter a new password for user pma>

Global privileges (leave all boxes unchecked)

5) 授予 pma 用户对新 phpmyadmin 数据库的完全访问权限。 再次选择首页 | 用户 | 编辑 pma 用户的权限。现在小心...选择屏幕顶部的“数据库”。在“在以下数据库上添加权限:”旁边选择 phpmyadmin。然后单击“全选”框,然后单击“开始”。

注意: pma 的全局权限仍应全部取消选中!

6) 编辑 /etc/phpmyadmin/config-db.php 并更改以下行:

 $dbuser='pma';
 $dbpass='<your pma user's password>';

7a)在 /etc/phpmyadmin/config.inc.php 中取消注释以下行:

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';

/* Server parameters */
if (empty($dbserver)) $dbserver = 'localhost';
$cfg['Servers'][$i]['host'] = $dbserver;

if (!empty($dbport) || $dbserver != 'localhost') {
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
    $cfg['Servers'][$i]['port'] = $dbport;
}
//$cfg['Servers'][$i]['compress'] = false;

/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysqli';

/* Optional: User for advanced features */
$cfg['Servers'][$i]['controluser'] = $dbuser;
$cfg['Servers'][$i]['controlpass'] = $dbpass;

/* Optional: Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = $dbname;
$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';
$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';

7b) 同样取消注释/etc/phpmyadmin/config.inc.php 中的以下行,并将 controluser 更改为“pma”,并将您的密码添加到下面的第 3 行:

/* Optional: User for advanced features */
 $cfg['Servers'][$i]['controluser'] = 'pma';
 $cfg['Servers'][$i]['controlpass'] = '<insert your password here>';

/* 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]['designer_coords'] = 'pma__designer_coords';
 $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';

8)然后注销/登录。


注意,在 Debian 上,重要的目录是:

  • /etc/phpmyadmin/ - 您的可编辑设置文件
  • /usr/share/phpmyadmin/libraries - 包括一个默认设置文件
于 2016-10-04T19:16:00.707 回答
1

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

  1. 在 mysql 中:

    在 phpmyadmin 上授予选择、插入、更新、删除。* 到 'pma'@'localhost';

  2. 在 ./config.inc.php 中:

    $cfg['Servers'][$i]['controluser'] = 'pma'; //在这里使用上面创建的任何用户名 $cfg['Servers'][$i]['controlpass'] = 'pmapass'; //在这里使用密码来匹配那个用户

于 2015-10-06T15:43:22.520 回答
0

For me on MySQL 4.6.0 the Designer view was accessible but would not save the layout state.

I then did the following to make it work:

  1. created a ./phpmyadmin/config/ directory
  2. chmod 777 config
  3. went to http://localhost/phpmyadmin/setup/ and followed basic instruction, using defaults
  4. then in the phpmyadmin web app there was a red hyperlink in a footer bubble that said something about a table needing to be created (I don't remember the exact text or which navigation section I was in... my guess was on a database in the operations tab). This created a new table called phpmyadmin and I think it's where the designer saves layouts to.

After doing this I was able to save the state of my designer layout - i.e. phpMyAdmin Designer was now enabled.

于 2016-05-25T11:18:37.197 回答