Monthly Archives: September 2017

Setting up foreign keys in phpMyAdmin

Step 1:
You have to add the line:
default-storage-engine = InnoDB
under the [mysqld] section of your mysql config file (my.cnf or my.ini depending on your OS) and restart the mysqld service.

 

 

 

 

 

 

 

 

 

Step 2:
Now when you create the table you will see the type of table is: InnoDB

 

 

 

 

 

Step 3:
Create both Parent and Child table. Now open the Child table and select the coloum U like to have the Foreign Key:
Select the Index Key from Action Label as shown below.

 

 

 

 

 

Step 4:
Now open the Relation View in the same child table from bottom near the Print View as shown below.

 

 

 

 

 

Step 5:
Select the coloumn U like to have the Foreign key as Select the Parent coloumn from the drop down.
dbName.TableName.ColoumnName

Select appropriate Values for ON DELETE and ON UPDATE

 

Advertisements

Leave a comment

Filed under General