Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 539
Sachin Prasad Avatar asked Oct 27 '12 23:10

Sachin Prasad


People also ask

How do I use on delete cascade and update cascade in MySQL?

Use the ON DELETE CASCADE option to specify whether you want rows deleted in a child table when corresponding rows are deleted in the parent table. If you do not specify cascading deletes, the default behavior of the database server prevents you from deleting data in a table if other tables reference it.

Does On Update Cascade also delete?

CASCADE. It is used in conjunction with ON DELETE or ON UPDATE. It means that the child data is either deleted or updated when the parent data is deleted or updated.


1 Answers

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 : highlighted a few buttons in phpmyadmin interface

like image 96
Cimbali Avatar answered Sep 29 '22 02:09

Cimbali