5.2 Creating A New MySQL Connection (Tutorial)

  1. Launch MySQL Workbench to open the home screen. Existing connections are shown when you click the MySQL Connections view from the sidebar. This tutorial adds a new connection.

    Figure 5.2 Getting Started Tutorial - Home Screen

    Getting Started Tutorial - Home Screen

  2. From the MySQL Workbench home screen, click the [+] icon near the MySQL Connections label to open the Setup New Connection wizard.

  3. Define the Connection Name value, such as MyFirstConnection.

    Figure 5.3 Getting Started Tutorial - Setup New Connection: MyFirstConnection

    Getting Started Tutorial - Setup New Connection: MyFirstConnection

    The default connection values are for a typical local setup, so check them and enter the appropriate values. If you are unsure, click the Test Connection button to check the connection parameters. Do not press OK.

    Next, optionally click Configure Server Management..., which opens up the Configure Local Management wizard:

  4. Read the Configure Local Management introduction, and press Next to begin defining the new connection parameters.

    Figure 5.4 Getting Started Tutorial - Configure Local Management Introduction

    Getting Started Tutorial - Configure Local Management Introduction

  5. The connection will now be tested. You should see that the connection was successful. If not, click Back and check that you have entered the information correctly.

    Figure 5.5 Getting Started Tutorial - Test Database Connection

    Getting Started Tutorial - Test Database Connection

    Toggle the Show Logs to view additional details about the tested connection, then click Next.

  6. Optionally, you may configure a method for remote management if a Remote Host was specified. Setting these options enables MySQL Workbench to determine the location of configuration files, and the correct start and stop commands to use for the connection.

    SSH login based management and Native Windows remote management types are available. The Operating System and MySQL Installation Type are configured for the SSH login variant.

    This step creates a local MySQL connection, so you can skip the Management and OS and SSH Configuration options, which are used for configuring a remote MySQL connection.

  7. On Microsoft Windows, select the appropriate MySQL service for the MySQL connection.

    Figure 5.6 Getting Started Tutorial - Windows Management

    Getting Started Tutorial - Windows Management

  8. The wizard will now check its ability to access the start and stop commands, and check access to the MySQL Server configuration file.

    Figure 5.7 Getting Started Tutorial - Test Settings

    Getting Started Tutorial - Test Settings

  9. You now have a chance to review the configuration settings. The information displayed varies slightly depending on platform, connection method, and installation type.

    At the Review Settings prompt, choose "I'd like to review the settings again" to review the settings. Choosing "Continue" closes the "Configure Server Management" dialog.

    Figure 5.8 Getting Started Tutorial - Review Settings

    Getting Started Tutorial - Review Settings

    Check the Change Parameters if you want to check or edit information about the MySQL configuration file. For this example, select the check box and click Next to continue.

  10. Review the MySQL configuration file information. Click the Check buttons to perform the described checks, or optionally change the configuration file path.

    Figure 5.9 Getting Started Tutorial - MySQL Configuration File

    Getting Started Tutorial - MySQL Configuration File

  11. Optionally, enter your own commands for starting, stopping, and checking the MySQL connection. Typically the default values are used, which means leaving these optional values blank.

    Figure 5.10 Getting Started Tutorial - Specify Commands

    Getting Started Tutorial - Specify Commands

    Click Finish to close the "Configure Server Management" dialog, which reveals the original Setup New Connection window.

  12. After reviewing the Setup New Connection information, press Test Connection again to make sure it still functions, and then OK to create the new MySQL connection.

    Figure 5.11 Getting Started Tutorial - Setup New Connection

    Getting Started Tutorial - Setup New Connection

  13. Your new MyFirstConnection MySQL connection is now listed on the home screen.

    Figure 5.12 Getting Started Tutorial - Home Screen Instance

    Getting Started Tutorial - Home Screen Instance

  14. From the home screen, click the new MySQL connection to open the SQL editor for this connection. The SQL editor is the default page, so now select the Server Status from the left Navigator panel to display the connected MySQL server's current status.

    Figure 5.13 Getting Started Tutorial - Server Status

    Getting Started Tutorial - Server Status

  15. Test the other Navigator panel options that relate to your new MySQL connection. Check its status, MySQL logs, and measure its performance statistics from the Dashboard.

    Notice the Management and Schemas tabs on the bottom of the Navigator panel. The Schemas view displays the schemas that are associated with your new MySQL connection. Alternatively, you can merge the Schemas and Management tabs by either clicking the merge icon on the top right of the Navigator panel, or by enabling the Show Management Tools and Schema Tree in a single tab SQL Editor preference.

This concludes the "Creating a MySQL connection" tutorial. For additional information about MySQL connections, see Chapter 5, Connections in MySQL Workbench.