MySQL 如何使用 phpmyadmin 添加删除级联和更新限制?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13105019/
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 add on delete cascade and on update restrict using phpmyadmin?
提问by Sachin Prasad
I want to add 'On delete cascade and on update restrict'
on foreign keys through phpmyadminuser Interface instead of executing query.
我想On delete cascade and on update restrict'
通过phpmyadmin用户界面在外键上添加 '而不是执行查询。
I generally use Heidisqlcontrol panel for doing these actions. And now I'm having hard time doing the same on phpmyadmin.
我通常使用Heidisql控制面板来执行这些操作。现在我很难在phpmyadmin上做同样的事情。
Any idea?
任何的想法?
回答by Cimbali
In the tab where you define the table structure, you get the list of columns and their properties and underneath that there should be a link "relation view", between "print view", and "propose table structure."
在您定义表结构的选项卡中,您将获得列及其属性的列表,在其下方应该有一个链接“关系视图”,位于“打印视图”和“建议表结构”之间。
That's where you want to go, but you have to have created the index on both tables already. Also, you might want to make sure you're using mysql's innoDB storage engine.
这就是你想去的地方,但你必须已经在两个表上创建了索引。此外,您可能希望确保您使用的是 mysql 的 innoDB 存储引擎。
Edit : An image is worth 1000 words :
编辑:一张图片价值 1000 字:
回答by FelDev
回答by Sdd Sdei
Key fact: 1. Both table must be have innodb storage engine. 2. The datatype and length should be same in both table. 3. The field in 2nd table should be created as index.
关键事实: 1. 两个表都必须有 innodb 存储引擎。2. 两个表中的数据类型和长度应该相同。3. 应将第二个表中的字段创建为索引。
Hope it will help someone...
希望它会帮助某人...