relations — phpmyadmin 5.2.0 documentation-尊龙登录

phpmyadmin allows relationships (similar to foreign keys) using mysql-native (innodb) methods when available and falling back on special phpmyadmin-only features when needed. there are two ways of editing these relations, with the relation view and the drag-and-drop designer – both of which are explained on this page.


you need to have configured the phpmyadmin configuration storage for using phpmyadmin only relations.

technical info

currently the only mysql table type that natively supports relationships is innodb. when using an innodb table, phpmyadmin will create real innodb relations which will be enforced by mysql no matter which application accesses the database. in the case of any other table type, phpmyadmin enforces the relations internally and those relations are not applied to any other application.

relation view

in order to get it working, you first have to properly create the [[pmadb|pmadb]]. once that is setup, select a table’s “structure” page. below the table definition, a link called “relation view” is shown. if you click that link, a page will be shown that offers you to create a link to another table for any (most) fields. only primary keys are shown there, so if the field you are referring to is not shown, you most likely are doing something wrong. the drop-down at the bottom is the field which will be used as the name for a record.

relation view example

_images/pma-relations-relation-view-link.png _images/pma-relations-relation-link.png

let’s say you have categories and links and one category can contain several links. your table structure would be something like this:

  • category.category_id (must be unique)


  • link.link_id

  • link.category_id

  • link.uri.

open the relation view (below the table structure) page for the link table and for category_id field, you select category.category_id as master record.

if you now browse the link table, the category_id field will be a clickable hyperlink to the proper category record. but all you see is just the category_id, not the name of the category.


to fix this, open the relation view of the category table and in the drop down at the bottom, select “name”. if you now browse the link table again and hover the mouse over the category_id hyperlink, the value from the related category will be shown as tooltip.



the designer feature is a graphical way of creating, editing, and displaying phpmyadmin relations. these relations are compatible with those created in phpmyadmin’s relation view.

to use this feature, you need a properly configured phpmyadmin configuration storage and must have the $cfg['servers'][$i]['table_coords'] configured.

to use the designer, select a database’s structure page, then look for the designer tab.

to export the view into pdf, you have to create pdf pages first. the designer creates the layout, how the tables shall be displayed. to finally export the view, you have to create this with a pdf page and select your layout, which you have created with the designer.