Aug
25
2009
25
2009
Create foreign key using Phpmyadmin
The innodb storage engine supports foreign keys in Mysql.
To create foreign keys in phpmyadmin :
1. Convert both tables into innodb, if they are not already.
2. View the structure of the table which will have a foreign key. Make the referencing field an INDEX.
3. Now come back to structure view and click Relation view.
In the Relation view page the field (which was made an INDEX) can be made a foreign key referencing to some other field in another table.
That should do it.
Popularity: 26% [?]
Related Posts
Subscribe
Recent Posts
- Compile wxwebconnect on Ubuntu 11.04 64 bit
- Disqus Comments Importer Script in PHP
- Beginners’ guide to socket programming with winsock
- Handle multiple socket connections with fd_set and select on Linux
- Beginners guide to socket programming in C on Linux
- Gui whois client in python with wxpython
- Whois client code in C with Linux sockets
- str_replace for C
- Easy to use C/C++ IDE for Ubuntu Linux
- Get local ip in C on linux
Binarytides
Tags
apache
applications
box2d
bsnl
c
chrome
cron
css
database
dns
firefox
flash
freelance
game programming
gd
graphs
hacking
htaccess
html
html5
imagemagick
java
javascript
libpcap
linux
mod rewrite
moneybookers
mootools
mvc
mysql
networking
payment
paypal
php
phpmyadmin
python
ruby
security
Sockets
software
swing
ubuntu
winpcap
winsock
xdebug
An article by Binary Tides







Hi,
this is great!
But I experienced that all my relations will be lost when I export and import the db.
Do you know a way to keep this relations alive after a backup/restore process?
Best wishes,
slevon
If you use mysqldump then foreign keys are kept intact in the table definition.
If you restore over existing tables (which dont have foreign key relation) then you need to drop tables so that fresh tables are created again with the correct foreign key relations.
Thank you very much. So much help
That’s what I was looking for. Now I can get associated models work together in CakePHP. Thanks!
Thank You very much…..
It ws really very useful….
tnx dear
Thanks. Clear and to the point.
hi..i wanna know how to create foreign key within phpmyadmin
can anyone plz help……
Thanks buddy
plz tell me how to create forign key in phpmyadmin through diagram………
thanks for the info. Just exactly what I need. :)