How to add on delete cascade and on update restrict using phpmyadmin?

怎甘沉沦 提交于 2019-12-03 09:28:58

问题


I want to add 'On delete cascade and on update restrict' on foreign keys through phpmyadmin user Interface instead of executing query.

I generally use Heidisql control panel for doing these actions. And now I'm having hard time doing the same on phpmyadmin.

Any idea?


回答1:


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.

Edit : An image is worth 1000 words :




回答2:


Cimbali's answer worked for me, but things were placed a little differently, so in case you're also looking for the "relation view" link, try looking there:

It should take you there:




回答3:


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.

Hope it will help someone...



来源:https://stackoverflow.com/questions/13105019/how-to-add-on-delete-cascade-and-on-update-restrict-using-phpmyadmin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!