3.5 Connection Management
MySQL Query Browser provides a Connection dialog that enables you to connect to a MySQL server, and a connection editor that you can use to create profiles that store connection parameters for later use. This section describes how to use the Connection dialog and the connection editor. The discussion also applies to MySQL Administrator, which has the same connection management facilities.
A connection profile is a set of connection parameters to which you assign a name. You can recall profiles by name later. The use of profiles makes it easy to set up and use connections for multiple servers. Connection profiles can be created in either MySQL Query Browser or MySQL Administrator, and are shared by the two programs. That is, a profile created within one program can be used within the other.
Profiles are stored in a file named mysqlx_user_connections.xml. The location of this file is the C:\Documents and Settings\user_name\Application Data\MySQL directory on Windows and the ~/.mysqlgui directory on Unix. Profiles are stored as plain text in XML format, which means that profiles are portable and have good cross-platform compatibility. A file containing connection profiles can be given to other users on the same or different machines. This makes it easy to set up standard profiles and distribute them, a feature that can be useful in a classroom or training setting, or if you want to distribute standard profiles along with an application.
The connections file is updated automatically when you use the Connection dialog or connection editor. Because the file is plain text, its contents can be edited by other programs as well, and the changes will be visible to the connection editor.
3.5.1 Using the Connection Dialog
MySQL Query Browser presents a Connection dialog when it starts or when you select New Instance Connection ... from the File menu. (See Figure 3.3.) This dialog enables you to connect to a MySQL server. You can either fill in its fields with the parameters required to connect to a server or select from among any predefined connection profiles. The Connection dialog also provides access to the connection editor, which enables you to create, edit, and delete connection profiles.
Figure 3.3 Connection dialog.
To connect to a MySQL server by specifying connection parameters directly, fill in the appropriate fields beginning with the Username field and click the OK button. To connect using the parameters stored in a connection profile, select the profile from the Connection drop-down list and click the OK button. To access the connection editor, click the ... button next to the Connection drop-down list.
3.5.2 Editing Connection Profiles
The connection editor enables you to create, edit, and delete connection profiles. The connection editor also maintains a history of recent connections. You can access this editor from the Connection dialog or by selecting Options ... from the Tools menu and selecting the Connections section of the Options dialog. In either case, the connection editor window is displayed, as shown in Figure 3.4.
Figure 3.4 Connection Editor.
The Connections section has a browser for existing connection profiles. It also displays a history of previous connections that were made without using a connection profile. The other part of the Connections section has a tab for specifying general connection parameters and another for other options. To edit a profile, select it in the browser and then modify the fields displayed by the two tabs. You can also use the Add New Connection and Delete buttons to create and delete profiles.