php 如何启用 phpMyAdmin 的设计器视图?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19166687/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I enable phpMyAdmin's Designer view?
提问by Carrie Kendall
I am running phpMyAdmin locally and I am trying to enable the Designer tool.
我在本地运行 phpMyAdmin 并尝试启用 Designer 工具。
How do you enable designer view for phpMyAdmin?
您如何为 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.
我已经阅读了很多关于如何为 phpMyAdmin 启用设计器视图的教程,它们都有不同的方向,但似乎从未真正让它工作。
I am using version 4.0.7
我使用的是 4.0.7 版
回答by Carrie Kendall
The following steps will enable the Designer in phpMyAdmin 4+ assuming that phpMyAdmin is inside the folder phpMyAdmin
:
假设 phpMyAdmin 在文件夹中,以下步骤将在 phpMyAdmin 4+ 中启用设计器phpMyAdmin
:
- Open
phpMyAdmin/config.inc.php
andphpMyAdmin/config.sample.inc.php
. - Locate the phpMyAdmin configuration storage settings in
config.sample.inc.php
(lines 38-66 in 4.0.7). - Copy all of the control user and storage db/table config and paste it into
config.inc.php
. When you get done, your config.inc.php should include something like this:
- 打开
phpMyAdmin/config.inc.php
和phpMyAdmin/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 Example:
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';
Note: We are just telling phpMyAdmin what database and table names to store specific configuration details at. Now let's add the database.
注意:我们只是告诉 phpMyAdmin 存储特定配置详细信息的数据库和表名称。现在让我们添加数据库。
- phpMyAdmin installs with the SQL we need to generate the database that the Designer relies on. We just need to locate the script. In 4.0.7 the file location is
phpMyAdmin/examples/create_tables.sql
. Alternatively, you can copy/download this from phpMyAdmin's github. - Once you locate the file, either import the file or copy/paste it into a SQL window and execute in phpMyAdmin.
- Now, everything should be configured properly. We need to clear cookies and restart the browser.
- When you open phpMyAdmin back up, navigate to a specific table and in the tabs you should see Designer tab.
- phpMyAdmin 安装了我们需要生成 Designer 所依赖的数据库的 SQL。我们只需要找到脚本。在 4.0.7 中,文件位置是
phpMyAdmin/examples/create_tables.sql
. 或者,您可以从phpMyAdmin 的 github复制/下载它。 - 找到文件后,导入文件或将其复制/粘贴到 SQL 窗口并在 phpMyAdmin 中执行。
- 现在,一切都应该正确配置。我们需要清除cookies并重新启动浏览器。
- 当你打开 phpMyAdmin 备份时,导航到一个特定的表,在选项卡中你应该看到设计器选项卡。
Disclaimer: These directions are specifically based on the new folder structure in phpMyAdmin 4+.You can apply the same directions by using phpMyAdmin's github config.sample.php
and the accompanying create-table.sql
. Choose your phpMyAdmin version by selecting the correct branch.
免责声明:这些说明专门基于 phpMyAdmin 4+ 中的新文件夹结构。您可以使用 phpMyAdmin 的 githubconfig.sample.php
和随附的create-table.sql
. 通过选择正确的分支来选择您的 phpMyAdmin 版本。
回答by Elliptical view
For Debian Jessie, 8.6 w/ phpMyAdmin 4:4.2.12-2+deb8u2 here's how I solved this:
对于 Debian Jessie, 8.6 w/ phpMyAdmin 4:4.2.12-2+deb8u2 这是我解决这个问题的方法:
I know this is quite involved. Clearly there is something wrong with the installer but I don't know where to start to get it fixed. So this is a workaround for now. There appear to be lots of people having problems with this issue, and it appears that there are a variety of solutions that work under different versions.
我知道这很复杂。显然安装程序有问题,但我不知道从哪里开始修复它。所以这是目前的解决方法。似乎有很多人遇到了这个问题,而且似乎有多种解决方案适用于不同版本。
0) As suggested in Debian setup noteshereI did this first. It didn't fix the issue, but it may have helped. It re-asks you questions and the -p low parameter makes sure to ask all of them:
0) 正如此处的Debian 安装说明中所建议的那样,我首先执行了此操作。它没有解决问题,但它可能有所帮助。它会重新询问您问题,并且 -p low 参数确保询问所有问题:
dpkg-reconfigure -plow phpmyadmin
It says "it creates a phpmyadmin database" (and it's tables), but it does not, so we'll create them manually below.
它说“它创建了一个 phpmyadmin 数据库”(它是表),但它没有,所以我们将在下面手动创建它们。
1) Run phpMyAdminby entering this into your browser, (you need to have PHP enabled support in your webserver). You'll need the username and password for your MariaDB or MySQL server. Normally the username is root. For me the server is local, so my Server Choice is localhost:
1)通过在浏览器中输入它来运行 phpMyAdmin,(您需要在您的网络服务器中启用 PHP 支持)。您将需要 MariaDB 或 MySQL 服务器的用户名和密码。通常用户名是root。对我来说,服务器是本地的,所以我的服务器选择是本地主机:
http://localhost/phpmyadmin/
2) Unzip /usr/share/doc/phpmyadmin/examples/create_tables.sql.gz and extract the SQL.I had to use an editor to strip the comment lines starting with "--".
2) 解压 /usr/share/doc/phpmyadmin/examples/create_tables.sql.gz 并解压 SQL。我不得不使用编辑器删除以“--”开头的注释行。
(( NOTE I think this archive might be temporarily corrupt as it gives an error when I try to manually unzip it. But you can use this trick to open it:
((注意我认为这个存档可能会暂时损坏,因为当我尝试手动解压缩它时它会出错。但是您可以使用此技巧打开它:
dd if=create_tables.sql.gz | gunzip -f
Also the GUI 'Open With Archive Manager' lets me open it.
此外,GUI“使用存档管理器打开”让我可以打开它。
3) Select the SQL tab, paste this sql from #2 into the SQL box,and click 'Go' to create the database and tables. (It's the missing SQL that's suppose to be in /etc/phpmyadmin/sql/create_tables.sql.)
3) 选择 SQL 选项卡,将#2 中的此 sql 粘贴到 SQL 框中,然后单击“执行”以创建数据库和表。(丢失的 SQL 应该在 /etc/phpmyadmin/sql/create_tables.sql 中。)
4) Create the sql user named 'pma'.Open phpMyAdmin, Select Home | Users | Add user, and add a new user named 'pma' as follows:
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) Give the pma user full access to the new phpmyadmin data base.Again select Home | Users | Edit Privileges for the pma user. Careful now... Select "Database" toward the top of the screen. Next to 'Add privileges on the following database:' select phpmyadmin. Then click the 'Check All' box, and click 'Go'.
5) 授予 pma 用户对新 phpmyadmin 数据库的完全访问权限。再次选择首页 | 用户 | 编辑 pma 用户的权限。现在小心...选择屏幕顶部的“数据库”。在“添加以下数据库的权限:”旁边,选择 phpmyadmin。然后单击“全部检查”框,然后单击“开始”。
NOTE: the Global privileges for pma should still be all unchecked!
注意: pma 的全局权限仍应全部取消选中!
6) Edit /etc/phpmyadmin/config-db.php and change the following lines:
6) 编辑 /etc/phpmyadmin/config-db.php 并更改以下几行:
$dbuser='pma';
$dbpass='<your pma user's password>';
7a) Uncomment the following linesin /etc/phpmyadmin/config.inc.php:
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) Also uncomment the following linesin /etc/phpmyadmin/config.inc.php, and change controluser to 'pma', and also add your password to line 3 below:
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) Then logout/login.
8) 然后注销/登录。
Note, on Debian the important directories are:
请注意,在 Debian 上,重要的目录是:
- /etc/phpmyadmin/ - your editable setup files
- /usr/share/phpmyadmin/libraries - includes a default setup file
- /etc/phpmyadmin/ - 您的可编辑设置文件
- /usr/share/phpmyadmin/libraries - 包括一个默认设置文件
回答by ben26941
It can be confusing, if you just follow the other answer. Yes, you need to change the configuration as explained, but this configuration refers to a MySQL user with special privileges. This is explained here: https://wiki.phpmyadmin.net/pma/controluserunder the section about pmadb features. Therefore, there are two steps: (copy-pasting from the linked page)
如果您只是按照另一个答案,这可能会令人困惑。是的,您需要按照说明更改配置,但此配置是指具有特殊权限的 MySQL 用户。这在这里解释:https: //wiki.phpmyadmin.net/pma/controluser 在关于 pmadb 功能的部分下。因此,有两个步骤:(从链接页面复制粘贴)
In mysql:
GRANT SELECT, INSERT, UPDATE, DELETE ON phpmyadmin.* TO 'pma'@'localhost';
In ./config.inc.php:
$cfg['Servers'][$i]['controluser'] = 'pma'; //Use here whatever username was created above $cfg['Servers'][$i]['controlpass'] = 'pmapass'; //use here the password to match that user
在 mysql 中:
授予选择,插入,更新,删除 phpmyadmin.* TO 'pma'@'localhost';
在 ./config.inc.php 中:
$cfg['Servers'][$i]['controluser'] = 'pma'; //这里使用在 $cfg['Servers'][$i]['controlpass'] = 'pmapass' 之上创建的任何用户名;//这里使用密码来匹配该用户
回答by Kit
For me on MySQL 4.6.0 the Designer view was accessible but would not save the layout state.
对于我在 MySQL 4.6.0 上的设计器视图是可访问的,但不会保存布局状态。
I then did the following to make it work:
然后我做了以下工作以使其工作:
- created a ./phpmyadmin/config/ directory
- chmod 777 config
- went to http://localhost/phpmyadmin/setup/and followed basic instruction, using defaults
- 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.
- 创建了一个 ./phpmyadmin/config/ 目录
- chmod 777 配置
- 转到http://localhost/phpmyadmin/setup/并遵循基本说明,使用默认值
- 然后在 phpmyadmin 网络应用程序中,页脚气泡中有一个红色超链接,上面写着需要创建的表格(我不记得确切的文本或我所在的导航部分……我猜是在数据库上)在操作选项卡中)。这创建了一个名为 phpmyadmin 的新表,我认为这是设计师将布局保存到的地方。
After doing this I was able to save the state of my designer layout - i.e. phpMyAdmin Designer was now enabled.
这样做后,我能够保存我的设计器布局的状态 - 即现在启用了 phpMyAdmin 设计器。