Table of Contents for
Mastering phpMyAdmin 3.4 for Effective MySQL Management

Version ebook / Retour

Cover image for bash Cookbook, 2nd Edition Mastering phpMyAdmin 3.4 for Effective MySQL Management by Marc Delisle Published by Packt Publishing, 2012
  1. Cover
  2. Mastering phpMyAdmin 3.4 for Effective MySQL Management
  3. Mastering phpMyAdmin 3.4 for Effective MySQL Management
  4. Credits
  5. About the Author
  6. About the Reviewers
  7. www.PacktPub.com
  8. Preface
  9. What you need for this book
  10. Who this book is for
  11. Conventions
  12. Reader feedback
  13. Customer support
  14. 1. Getting Started with phpMyAdmin
  15. What is phpMyAdmin?
  16. Installing phpMyAdmin
  17. Configuring phpMyAdmin
  18. Installing phpMyAdmin configuration storage
  19. Upgrading phpMyAdmin
  20. Summary
  21. 2. Configuring Authentication and Security
  22. Securing phpMyAdmin
  23. Summary
  24. 3. Over Viewing the Interface
  25. Customizing general settings
  26. Character sets and collations
  27. Navigation panel
  28. Main panel
  29. User preferences
  30. Query window
  31. Summary
  32. 4. Creating and Browsing Tables
  33. Creating our first table
  34. Inserting data manually
  35. Browse mode
  36. Profiling queries
  37. Creating an additional table
  38. Summary
  39. 5. Changing Data and Structure
  40. Changing table structure
  41. Summary
  42. 6. Exporting Structure and Data (Backup)
  43. Exporting a database
  44. Exporting a table
  45. Exporting selectively
  46. Exporting multiple databases
  47. Saving the export file on the server
  48. Memory limits
  49. Summary
  50. 7. Importing Structure and Data
  51. Importing SQL files
  52. Importing CSV files
  53. Importing other formats
  54. Reading files from a web server upload directory
  55. Displaying an upload progress bar
  56. Summary
  57. 8. Searching Data
  58. Performing a complete database search
  59. Stopping an errant query
  60. Summary
  61. 9. Performing Table and Database Operations
  62. Changing table attributes
  63. Emptying or deleting a table
  64. Renaming, moving, and copying tables
  65. Performing other table operations
  66. Multi-table operations
  67. Database operations
  68. Summary
  69. 10. Benefiting from the Relational System
  70. Defining relations with the relation view
  71. Defining relations with the Designer
  72. Benefiting from the defined relations
  73. Column commenting
  74. Summary
  75. 11. Entering SQL Statements
  76. The Query window
  77. Multi-statement queries
  78. Pretty printing (syntax highlighting)
  79. The SQL Validator
  80. Summary
  81. 12. Generating Multi-table Queries
  82. Exploring column criteria
  83. Generating automatic joins (internal relations)
  84. Executing the query
  85. The visual builder
  86. Summary
  87. 13. Synchronizing Data and Supporting Replication
  88. Supporting MySQL replication
  89. Summary
  90. 14. Using Query Bookmarks
  91. Creating bookmarks
  92. Recalling bookmarks from the bookmarks list
  93. Passing a parameter to a bookmark
  94. Summary
  95. 15. Documenting the System
  96. Generating relational schemas
  97. Summary
  98. 16. Transforming Data using MIME
  99. Enabling transformations
  100. Examples of transformations
  101. Summary
  102. 17. Supporting Features Added in MySQL 5
  103. Supporting routines—stored procedures and functions
  104. Executing code with triggers
  105. Using information_schema
  106. Partitioning
  107. Exploring the event scheduler
  108. Summary
  109. 18. Tracking Changes
  110. Prerequisites
  111. Principles
  112. Initiating tracking for one table
  113. Testing the tracking mechanism
  114. Determining tracking status
  115. Structure snapshot
  116. Exporting a version
  117. Creating a new version
  118. Deleting tracking information
  119. Summary
  120. 19. Administrating the MySQL Server
  121. Database information
  122. Server information
  123. Summary
  124. A. Troubleshooting and Support
  125. Seeking support
  126. Contributing to the project

Benefiting from the defined relations

In this section, we will look at the benefits of the defined relations that we can currently test. Other benefits will be described in Chapter 12 and Chapter 15. Additional benefits of the phpMyAdmin configuration storage will appear in Chapter 14, Chapter 16, and Chapter 18.

These benefits are available for both internal and foreign key relations.

Foreign key information

Let us browse the book table. We see that the values of the related key (author_id) are now links. Moving the cursor over any author_id value reveals the author's name (as defined by the display column of the author table).

Foreign key information

Clicking on the author_id brings us to the relevant table —author—for this specific author:

Foreign key information

Instead of viewing the keys, we might prefer to see the display column for all the rows. Going back to the book table, we can select the Relational display column display option and click on Go. This produces a screen similar to the following screenshot:

Foreign key information

We now switch back to viewing the keys by selecting Relational key and clicking on Go.

The drop-down list of foreign keys

Displaying the book table, in Insert mode (or in Edit mode), there is now a drop-down list of the possible keys for each column that has a defined relation. The list contains the keys and the description (display column) in both orders—key to the display column as well as display column to the key. This enables us to use the keyboard and type the first letter of either the key or the display column.

The drop-down list of foreign keys

Note

Only the key (in this case 1) will be stored in the book table. The display column is shown only to assist us.

By default, this drop-down list will appear if there are a maximum of 100 rows in the foreign table. This is controlled by the following parameter:

$cfg['ForeignKeyMaxLimit'] = 100;

For foreign tables bigger than that, a distinct window appears—the foreign-table window (refer to the next section) that can be browsed.

We might prefer to see information differently in the drop-down list. Here, John Smith is the content and 1 is the ID. The default display is controlled by the following line of code:

$cfg['ForeignKeyDropdownOrder'] = array( 'content-id', 'id-content');

We can use one or both of the strings—content-id and id-content—in the defining array and in the order we prefer. Thus, defining $cfg['ForeignKeyDropdownOrder'] to array('id-content') would produce a list with only those choices:

1 John Smith
2 Maria Sunshine
3 André Smith

The browseable foreign-table window

Our current author table has very few entries. Thus, to illustrate this mechanism, we will set the $cfg['ForeignKeyMaxLimit'] to an artificially low number, 1. Now in the Insert mode for the book table, we see a small table-shaped icon and a Browse foreign values link for author_id column. This icon opens another window, which will present the values of the author table and a Search input field. On the left, the values are sorted by key value (here, the id column), and on the right, they are sorted by description.

The browseable foreign-table window

Choosing one of the values (by clicking either a key value or a description) closes this window and brings the value back to the author_id column.

Referential integrity checks

We discussed the Operations page and its Table maintenance section in Chapter 9. For this exercise, we suppose that both the book and author tables are not under the control of the InnoDB or PBXT storage engine. If we have defined an internal relation for the author table, a new choice appears for the book table—Check referential integrity.

Referential integrity checks

A link (author_id -> author.id) appears for each defined relation, and clicking on it starts verification. For each row, the presence of the corresponding key in the foreign table is verified and errors, if any, are reported. If the resulting page reports zero rows, it is good news!

This operation exists because for tables under the storage engines that do not support foreign key natively, neither MySQL nor phpMyAdmin enforces referential integrity. It is perfectly possible, for example, to insert data in the book table with invalid values for author_id column.

Automatic updates of metadata

phpMyAdmin keeps the metadata for internal relations synchronized with every change that is made to the tables via phpMyAdmin. For example, renaming a column that is part of a relation would make phpMyAdmin rename this column in the metadata for the relation. This guarantees that an internal relation continues to function, even after a column's name is changed. The same thing happens when a column or table is dropped.

Note

Metadata should be maintained manually in case a change in the structure is done from outside phpMyAdmin.