Critical Skill 6.2 Use MySQL Control Center


The MySQL Control Center (MySQLCC) is a GUI that allows you easy access to the databases, tables, and data on your MySQL Server. It provides a point-and-click environment for speedy and simple command access, as well as a visual overview of your database design and contents. It supplies you with a syntax-highlighting text editor for constructing queries and allows you to do some database and table management. MySQLCC also allows you to view and change some server variables .

Note  

This section refers to MySQL Control Center version 0.9.4-beta.

Everything that can be accomplished in MySQLCC can be accomplished using the command line. MySQLCC is simply a tool for those users more familiar with or more comfortable with a GUI interface. There are some specific situations in which MySQLCC will be easier or simpler to use than the command line. For instance, reading large amounts of data in each record is easier using a GUI interface than using the command line; when long lines continue to the next line, correlating a field with its header can be difficult. As you experiment with MySQLCC, you will develop your own preferences for using the GUI and using the command line.

MySQLCC can appear with a main Control Center window and a separate Console Manager window, as shown in Figure 6-14 (with the Console Manager window minimized). Whether there are separate MySQLCC windows depends on the MDI setting in the program s Options menu, as described shortly.


Figure 6-14: The main Control Center window with a minimized Console Manager window

Choosing MySQLCC Menu Options

The menu bar at the top of the Control Center window has five drop-down menus :

  • Console This menu has only one option: Exit. Choosing Exit causes MySQLCC to close; it s equivalent to clicking the Close button (with the X) in the upper-right corner of the window.

  • Options This menu has four choices: MDI, Themes, Fonts, and General. These are discussed in the next section.

  • HotKeys This menu contains only the option to open the HotKey Editor, which lets you edit the existing hotkeys (shortcut keys) or add new ones.

  • Window This menu has an option for toggling the display of the Console Manager. It also has options that allow you to close only the window that is currently highlighted or close all the windows that are currently open in MySQLCC. There are also two options for arranging the windows when you have more than one of them open and wish to navigate between them: Cascade and Tile.

  • Help This menu, ironically enough, offers very little in the way of help. It does show information on the version number of MySQLCC you are running and a list of names and e-mail addresses of those who contributed to the design of the program.

Selecting MySQLCC Options

You can select the following options from the Options menu to control some aspects of MySQLCC:

  • MDI This option runs MySQLCC in MDI (Multiple Document Interface) mode. When you choose MDI, you ll see a message noting that MySQLCC needs to be restarted before it reflects the change you just made. When MySQLCC is in MDI mode, a Console Manager window will appear within a Control Center window. When not in MDI mode, there is no main Control Center window; only a Console Manager window appears. This is normally referred to as SDI (Single Document Interface) mode, but MySQLCC does not use that acronym. The SDI Console Manager window has some of the menu choices from the main Control Center window, as shown in Figure 6-15.


    Figure 6-15: MySQLCC when the MDI option is not selected

  • Themes This option allows you to choose between six different themes that change the appearance of the MySQLCC windows. The changes take place immediately (you don t need to restart the program), so it is easy to experiment to decide which theme you prefer.

  • Fonts This option allows you to choose the font, style, size , and effects for the application and printer fonts. The application fonts are the ones used for text in all of the MySQLCC windows. The printer fonts are those used for documents sent to the printer from MySQLCC. The Query Editor Fonts option opens a dialog box with a tab that allows you to view and change a few variables regarding the Query Editor.

  • General This option brings up the same dialog box as choosing Query Editor Fonts, but displaying a tab that allows you to view and alter some general information, including paths to sound files, language, size of the History file, and other variables. The dialog box has tabs containing variables regarding queries, plug-ins, and syntax highlighting. These tabs have Apply or Cancel buttons for saving or discarding any changes you ve made.

Using the Console Manager

Whether or not you run MySQLCC in MDI mode, the Console Manager functions in nearly the same manner. If the program is in MDI mode, the Console Manager s menu bar holds the File, View, Action, and HotKeys menu, as shown in Figure 6-16. If it is not in MDI mode, the menu bar adds the two menus that would have been in the main Control Center window s menu bar: Options and Help.


Figure 6-16: The Console Manager window in MDI mode with main Control Center window

The Console Manager window consists of three areas of information:

  • The tree pane on the left, which shows the databases on your MySQL Server (or servers), plus User Administration and Server Administration categories

  • The main display area on the right, which changes contents depending on what is selected in the tree pane

  • The pane at the bottom, which holds messages and SQL debug information, each on its own tab

Using the Console Manager Menus and Toolbar

The Console Manager window s menu bar has four menus (in MDI mode):

  • File This menu allows you to open a new connection, refresh the current display of information, open the SQL Query Editor window (shown in Figure 6-17), and close the Console Manager window.


    Figure 6-17: The SQL Query Editor window

  • View This menu allows you to turn on and off the tree and message displays in the Console Manager window. Their display can also be turned off using the Close button in the upper-right corner of each display, but the View drop-down is the only place when they can be turned back on.

  • Action This menu changes depending on what is selected in the tree pane. It provides the same options as the Console Manager window s toolbar buttons, described in the next sections.

    Note  

    If you can t find a particular function in the Action menu, it may because you do not have the corresponding area selected in the tree pane.

  • HotKeys This menu has an option for the HotKeys Editor, which works in the same way as it does when accessed from the main Control Center window.

The Console Manager toolbar buttons change depending on what is selected in the tree pane, as described in the next section. However, in all these displays, the first three buttons are always the same.

These buttons, from left to right, allow you to add new connection definitions and variables, refresh the current display, and open the SQL Query Editor (see Figure 6-17).

Viewing Information and Performing Actions

You can select seven levels of information in the MySQLCC tree pane:

  • Server

  • Databases

  • Specific database

  • Tables

  • Specific table

  • Server administration

  • User administration

Server-level Information When the server level of information is selected in the tree, the display of information in the right window is server- related , as shown in Figure 6-18.


Figure 6-18: The Console Manager with the server level selected in the tree pane

Along with the first three standard toolbar buttons (described in the previous section), the toolbar in this view contains four buttons related to the server information.

The server-level toolbar buttons perform the following tasks :

  • Disconnect or Connect Clicking the button performs either action, depending on the current status between the GUI and the server.

  • Edit Opens a window allowing variables to be accessed.

  • Delete Deletes the currently saved server connection information.

  • New Window from Here Opens a new instance of the Control Manager window.

Database-level Information When the databases level of information is selected in the tree pane, the display of information in the right window is about the database in general, as shown in Figure 6-19.


Figure 6-19: The Console Manager with the databases level selected in the tree pane

The Console Manager toolbar buttons in the database-level view, from left to right, create a new database, refresh the existing display, and open a new instance of the Control Manager window.

Specific Database Information When you ve selected a specific database in the tree pane, the display of information in the right window is the same as the information shown at the databases level (see Figure 6-19). The toolbar buttons, from left to right, disconnect or connect to the specific database, drop the specific database, and open a new instance of the Control Manager window.

Tables-level Information When the tables level of information is selected in the tree pane, the display of information in the right window shows all the tables for the database, as shown in Figure 6-20.


Figure 6-20: The Console Manager with the tables level selected in the tree pane

The toolbar buttons in this view, from left to right, open a window that allows you to define a new table for the database, display the Tools menu, allow you to import tables, refresh the tables, and open a new instance of the Control Manager window.

The Tools menu that opens when you click the Tools button on the toolbar offers Analyze, Check, Optimize, Repair Tables, and SHOW CREATE options. The SHOW CREATE option brings up a list of current tables to run the SHOW CREATE command on. By choosing a table and one of the Tools options, MySQLCC automatically composes the necessary SQL commands and sends them to the database, relieving you of having to remember the correct syntax. You can click the History tab at the bottom of the window to see a listing of SQL commands sent to the database. The SHOW CREATE command ultimately brings up a Query window showing the command used to create the specified table.

Specific Table Information When you ve selected a specific table in the tree pane, the display on the right shows all the column definitions for the table, as shown in Figure 6-21.


Figure 6-21: The Console Manager with a specific table selected in the tree pane

The toolbar in this view contains nine buttons related to the server information.

These toolbar buttons represent the bulk of MySQLCC s table definition and data editing capabilities. They work as follows :

  • Open Table Opens a menu with two options: Return All Rows and Return Limit. Return All Rows brings up a Query window with the data contents of the selected table, as shown in Figure 6-22. This window allows you to insert and delete rows, change column definitions, and edit data on an individual field basis, as well as perform various other table- and data-related functions. The Return Limit option brings up a dialog box asking for a limit number, and then displays only that many records.


    Figure 6-22: The Query window displaying all rows in a table

  • Edit Table Brings up an editing window that allows you to edit a table by row or column, including changing the table definition, as shown in Figure 6-23.


    Figure 6-23: The window for editing a table

  • Properties Brings up a display of general properties for the specified table, but only for viewing. You cannot make any changes in the Properties window.

  • Export Allows you to export table information.

  • Tools Opens the Tools menu, described in the previous section.

  • Empty Table Removes all the data from a table, permanently, while leaving the table definition intact.

  • Drop Table Removes the table and its data from the database permanently.

  • Rename Table Allows you to change the name of the selected table.

  • Refresh Fields Gets up-to-date information from the database for the table display.

Server Administration Information When you ve selected Server Administration in the tree pane, the display to the right is essentially the same as the information displayed in the databases and specific database levels (see Figure 6-19).

The toolbar in this view contains seven buttons related to administering the server.

The Server Administration toolbar buttons perform the following tasks:

  • Show Process List Brings up the Administration window with the Process List tab displayed.

  • Show Status Brings up the Administration window with the Status tab displayed.

  • Show Variables Brings up the Administration window with the Variables tab displayed.

  • Flush Opens a menu with nine options that you can choose to flush the database.

  • Ping Checks to see if the mysqld process is alive and returns a message to the Message window at the bottom of the Administration window.

  • Shutdown Closes the MySQL Client after verification.

  • New Window from Here Opens a new instance of the Control Manager window.

User Administration Information When you ve selected User Administration in the tree pane, the display to the right is essentially the same as the information displayed in the databases and specific database levels (see Figure 6-19).

The toolbar buttons in this view, from left to right, connect and disconnect to the server supplying a list of the users, add a new user, refresh tables, and open a new instance of the Control Manager window.

Selecting one of the users listed under User Administration changes the buttons available on the toolbar. In this view, from left to right, the buttons allow you to edit the user, delete the user, and add a user.




MySQL(c) Essential Skills
MySQL: Essential Skills
ISBN: 0072255137
EAN: 2147483647
Year: 2006
Pages: 109

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net