4.2 Making a Connection

Once the connector is installed, you can use it to create, modify, and delete connections to MySQL databases. To create a connection with a MySQL database, perform the following steps:

  • Start Visual Studio, and open the Server Explorer window (View, Server Explorer option in the main Visual Studio menu, or Control+W, L keyboard shortcuts).

  • Right-click the Data Connections node, and choose the Add Connection... menu item.

  • Add Connection dialog opens. Press the Change button to choose MySQL Database as a data source.

    Figure 4.1 Add Connection Context Menu

    Add Connection Context Menu

  • Change Data Source dialog opens. Choose MySQL Database in the list of data sources (or the <other> option, if MySQL Database is absent), and then choose .NET Framework Data Provider for MySQL in the combo box of data providers.

    Figure 4.2 Choose Data Source

    Choose Data Source

  • Input the connection settings: the server host name (for example, localhost if the MySQL server is installed on the local machine), the user name, the password, and the default schema name. Note that you must specify the default schema name to open the connection.

    Figure 4.3 Add Connection Dialog

    Add Connection Dialog

  • You can also set the port to connect with the MySQL server by pressing the Advanced button. To test connection with the MySQL server, set the server host name, the user name, and the password, and press the Test Connection button. If the test succeeds, the success confirmation dialog opens.

  • After you set all settings and test the connection, press OK. The newly created connection is displayed in Server Explorer. Now you can work with the MySQL server through standard Server Explorer GUI.

    Figure 4.4 New Data Connection

    New Data Connection

After the connection is successfully established, all settings are saved for future use. When you start Visual Studio for the next time, open the connection node in Server Explorer to establish a connection to the MySQL server again.

To modify and delete a connection, use the Server Explorer context menu for the corresponding node. You can modify any of the settings by overwriting the existing values with new ones. Note that the connection may be modified or deleted only if no active editor for its objects is opened: otherwise, you may lose your data.

Download this Manual
PDF (US Ltr) - 5.5Mb
PDF (A4) - 5.5Mb
EPUB - 4.7Mb
HTML Download (TGZ) - 4.6Mb
HTML Download (Zip) - 4.6Mb
User Comments
Sign Up Login You must be logged in to post a comment.