MySQL 如何在 phpmyadmin 中启用关系视图
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8420183/
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 to enable relation view in phpmyadmin
提问by NeverPhased
When working in XAMPP with phpmyadmin, after creating a table I have the option to click "relation view" after clicking on the structure tab. See below:
当使用 phpmyadmin 在 XAMPP 中工作时,创建表后,我可以选择在单击结构选项卡后单击“关系视图”。见下文:
However anytime when I create a table with my host phpmyadmin, I dont have the option to select "relation view" See below:
但是,当我使用主机 phpmyadmin 创建表时,我没有选择“关系视图”的选项,见下文:
Is there anyway of enabling this? Currently I have to set up relationships in xampp and export to my host phpmyadmin for it to work.
有没有启用这个?目前我必须在 xampp 中建立关系并导出到我的主机 phpmyadmin 才能使其工作。
回答by Harley
Change your storage engine to InnoDB by going to Operation
通过转到操作将您的存储引擎更改为 InnoDB
回答by Alfonso Pérez
If it's too late at night and your table is already innoDB and you still don't see the link, maybe is due to the fact that now it's placed above the structure of the table, like in the picture is shown
如果太晚了,你的表已经是innoDB了,你还是看不到链接,可能是因为现在它被放置在表的结构上方,如图所示
回答by aisha
first select the table you you would like to make the relation with >> then go to operation , for each table there is difference operation setting, >> inside operation "storage engine" choose innoDB option
首先选择你想与之建立关系的表>>然后去操作,每个表都有不同的操作设置,>>在操作“存储引擎”中选择innoDB选项
innoDB will allow you to view the "relation view" which will help you make the foreign key
innoDB 将允许您查看“关系视图”,这将帮助您制作外键
回答by Meetai.com
Enabling Relation View in phpMyAdmin / MAMP
在 phpMyAdmin / MAMP 中启用关系视图
If you're using MAMP for your database driven projects you'll probably be using phpMyAdmin to administer your MySQL database if you've decided to go down that route. If you're creating a database you might be wondering how to create relationships and foriegn keys for your tables.
如果您将 MAMP 用于您的数据库驱动项目,那么您可能会使用 phpMyAdmin 来管理您的 MySQL 数据库,如果您决定走这条路的话。如果您正在创建一个数据库,您可能想知道如何为您的表创建关系和外键。
Firstly you need to check that you have access to the Relation view. To do this open phpMyAdmin and select a database. You need to make sure your tables' storage engine is set to use InnoDB. Click on a table within your database and choose the Operations tab. Make sure that the storage engine is set to use InnoDB and save your changes.
首先,您需要检查您是否有权访问“关系”视图。为此,请打开 phpMyAdmin 并选择一个数据库。您需要确保您的表的存储引擎设置为使用 InnoDB。单击数据库中的表并选择“操作”选项卡。确保存储引擎设置为使用 InnoDB 并保存您的更改。
Now, go back to your table view and click the Structure tab. Depending on your version of phpMyAdmin you should see a link titled Relation view below the table structure. If you can see it you're good to go. If you can't you'll need to follow the steps below to set phpMyAdmin to enable Relations view.
现在,返回您的表格视图并单击 Structure 选项卡。根据您的 phpMyAdmin 版本,您应该会在表结构下方看到一个标题为 Relation view 的链接。如果你能看到它,你就可以走了。如果不能,则需要按照以下步骤设置 phpMyAdmin 以启用关系视图。
- Find
/Applications/MAMP/bin/phpMyAdmin/scripts/create_tables.sql
- I left this file default but you can change the table name to anything you want. I left mine phpMyAdmin
- Open phpMyAdmin and go to the Importtab.
- Click the browse button and find the create_tables.sql file and then click Go.
- The tables required for Relation view will be added to the database you specified.
- Open
/Applications/MAMP/bin/phpMyAdmin/config.inc.php
Find the Server(s) configuration code block and replace/uncomment the following code and fill in the values. If you left everything default in the create_tables.sql file then you should just cut and paste the lines below.
$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';
Save the file and restart MAMPand refresh your phpMyAdmin console.
Go to your database and view one of your tables in Structure mode. You should now see the Relation view link.
- 找
/Applications/MAMP/bin/phpMyAdmin/scripts/create_tables.sql
- 我将此文件保留为默认值,但您可以将表名更改为您想要的任何名称。我离开了我的 phpMyAdmin
- 打开 phpMyAdmin 并转到“导入”选项卡。
- 单击浏览按钮并找到 create_tables.sql 文件,然后单击Go。
- 关系视图所需的表将添加到您指定的数据库中。
- 打开
/Applications/MAMP/bin/phpMyAdmin/config.inc.php
找到 Server(s) 配置代码块并替换/取消注释以下代码并填写值。如果您在 create_tables.sql 文件中保留所有默认值,那么您应该剪切并粘贴下面的行。
$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';
保存文件并重新启动 MAMP并刷新您的 phpMyAdmin 控制台。
转到您的数据库并在结构模式下查看您的表之一。您现在应该看到 Relation 视图链接。
Source: http://newvibes.com/blog/enabling-relation-view-in-phpmyadmin-mamp/
来源:http: //newvibes.com/blog/enabling-relation-view-in-phpmyadmin-mamp/
回答by mahditfi lotfi
1 - Change Your tables search engine from 'My ISAM' to 'Inno DB' by Operations tab 2 - you must do this for all tables that you want make relationship between 3 - localhost/phpmyadmin/tbl_relation.php?db=your_database_name&table=your_table_namethen replace this url in browser, then you will be able to see the relationship page
1 - 通过操作选项卡将您的表搜索引擎从“我的 ISAM”更改为“Inno DB” 2 - 您必须为要在 3 - localhost/phpmyadmin/tbl_relation.php?db=your_database_name&table=your_table_name之间建立关系的所有表执行此操作然后在浏览器中替换这个url,就可以看到关系页面了