Chapter 6 Configuration

Table of Contents

6.1 Global Options and Preferences
6.2 Managing MySQL Connections

This section is divided into two overlapping topics; configuring the global options, and managing the MySQL connections.

6.1 Global Options and Preferences

Each action, such as Import MySQL Data, has its own set of options. The buttons on these pages include:

Actions include:

  • Clicking Accept: Saves option changes to your host, and preserves these changes across all sessions and future Excel instances.

  • Clicking Reset to Defaults: Resets all option values on the current options window to their default settings. Click Accept to save the changes.

A set of "global" options affect the entire plugin, as described here:

Figure 6.1 The MySQL for Excel configuration: Global Options

The MySQL for Excel configuration: Global Options

  • Connection Options:

    • Wait [ ] seconds for a connection to the server before timing out. Defaults to 15.

    • Wait [ ] seconds for a database query to execute before timing out. Defaults to 60.

  • SQL Queries Options:

    • [ ] Use optimistic updates on all Edit Data sessions. This option helps prevent unintentional data overwrite, in that it checks for external edits before committing your changes. For example, between the time you loaded the data into Excel, made changes in Excel, and committed, a different user could have edited the same cells elsewhere in MySQL using MySQL Workbench or some other means. The optimistic updates feature checks for these changes, and notifies you accordingly.

      Optimistic updates can also be configured at runtime for all Edit Sessions, or for a specific edit session by right-clicking the Edit Session floating dialog and choosing the desired Use Optimistic Update option, as demonstrated below:

      Figure 6.2 Optimistic Updates: Configuring at Runtime

      Optimistic Updates: Configuring at Runtime

      This option is enabled by default.

    • ( ) Do not show SQL statements sent to the server: When enabled, SQL statements are now displayed, and only their results are displayed in the information dialog. Enabled by default.

    • ( ) Preview SQL statements before they are sent to the server: When enabled, it adds an extra step to the Create Schema, Export Data, Append Data and Edit Data operations before a statement is committed to the server. It enables the "Review SQL Script" dialog, as shown below for an "Export Data" operation:

      Figure 6.3 The MySQL for Excel configuration: Preview Option

      The MySQL for Excel configuration: Preview Option

      From here you can modify the SQL statements before they are executed, which also enables the Original Query button. If clicked, it will revert all modifications to the script to restore the SQL to its original form (when the dialog was first opened).

      This option is disabled by default.

    • ( ) Show executed SQL statements along with their results: When enabled, SQL statements are first executed and then the information dialog includes both the results and the executed statements. This is helpful when reviewing the recently executed queries when comparing the results.

      This option is disabled by default.

  • Edit Session Options:

    • [ ] Restore saved Edit sessions when opening an Excel workbook. Enabled by default.

    • ( ) Reuse Excel worksheets matching their names with the session table names. Enabled by default.

    • ( ) Create new Excel worksheets for the restored Edit sessions. Disabled by default.

  • Manage Stored Import and Edit Connections: See a list of saved Excel files with linked MySQL connections.

    Figure 6.4 MySQL for Excel: Manage Stored MySQL Connections

    MySQL for Excel: Manage Stored MySQL Connections

    This lists the connected Excel worksheets that are known to MySQL for Excel. From here you can view these connections, and optionally delete them. By default, clicking Apply will delete connections to missing worksheets but this behavior is configurable. Additionally, clicking the Select connection information entries link checks (selects for deletion) books that you have not accessed for n days, where n defaults to 30.

    Note

    This option was added in MySQL for Excel 1.3.0

    Note

    The options to automatically delete missing connections, or delete connections not accessed for n days, were added in MySQL for Excel 1.3.4.

    For additional information about managing MySQL connections using MySQL for Excel, see Section 6.2, “Managing MySQL Connections”.

Adding a New Schema

Select a MySQL connection and then click Create New Schema from the MySQL for Excel toolbar to add a new and empty MySQL schema.

Figure 6.5 MySQL for Excel: Adding a New Schema

MySQL for Excel: Adding a New Schema

6.2 Managing MySQL Connections

MySQL for Excel shares its MySQL connections with MySQL Workbench, although it is optional to have MySQL Workbench installed. Creating and editing MySQL connections in either application will edit the MySQL connection information for both applications.

Adding MySQL Connections

You can use MySQL for Excel or MySQL Workbench to add new MySQL connections.

Figure 6.6 MySQL for Excel: Add a New MySQL Connection

MySQL for Excel: Add a New MySQL Connection

From Excel, click New Connection to open the new connection dialog as demonstrated in the following partially filled screenshot:

Figure 6.7 MySQL for Excel: Add a New MySQL Connection Dialog

MySQL for Excel: Add a New MySQL Connection Dialog

Fill out the connection details, click Test Connection to confirm the MySQL connection is valid, and click OK to save the new connection.

Editing MySQL Connections

Editing MySQL Connections in MySQL for Excel

To edit a MySQL connection, right-click the connection you want to modify and select Edit Connection from the context menu, like so:

Figure 6.8 MySQL for Excel: Choosing a MySQL Connection to Edit

MySQL for Excel: Choosing a MySQL Connection to Edit

The MySQL connection edit dialog is similar to the edit dialog in MySQL Workbench. Configure the changes and click OK to save your changes:

Figure 6.9 MySQL for Excel: Editing a MySQL Connection

MySQL for Excel: Editing a MySQL Connection

Editing MySQL Connections in MySQL Workbench

Optionally, you can edit your MySQL for Excel MySQL connections using MySQL Workbench. To do this, open MySQL Workbench, edit a MySQL connection, and then refresh the connection list in MySQL for Excel.

For information about editing MySQL connections in MySQL Workbench, see the MySQL Workbench documentation titled MySQL Connections.

Delete MySQL Connections

MySQL connections can be deleted from MySQL for Excel or MySQL Workbench.

Note

MySQL connections cannot be deleted if MySQL Workbench is open. To remove connections, you must first close MySQL Workbench.

To delete an edit or import connection from MySQL for Excel to a particular Excel worksheet, click Options, Manage Stored Import and Edit Connection, check the desired worksheets, and then click Apply to execute the delete action.