Connecting to a DB System

This topic describes how to connect to a MySQL DB System using such tools as MySQL Workbench and SSH.

Connecting to the MySQL DB System

This topic describes how to ssh into a Linux Compute instance, on the same VCN as your DB System, and use the mysql command line client to connect to your MySQL DB System's Endpoint.

This task requires the following:
  • A running VCN
  • A running MySQL DB System attached to the VCN. Make note of the IP address of the MySQL Endpoint in the DB System, and the administration user and password. To find the IP Address, see Endpoints
  • A running Compute instance (Oracle Linux is used in the following example) attached to a public subnet on the same VCN as the MySQL DB System. Make note of the public IP address of the compute instance . The SSH port, 22, is added to the public subnet by default. For more information, see Network Setup.
  1. SSH into the compute instance from your local machine using the opc user and the public IP address of the compute instance.
    ssh opc@computeInstancePublicIP
  2. Install the MySQL client on the Compute instance using the following commands:
    shell> sudo yum install https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
    shell> sudo yum install mysql
  3. Connect to your DB System using the MySQL client.
    shell> mysql --host IPAddressOfMySQLDBSystemEndpoint -u Username -p 

Connecting from MySQL Workbench

This topic describes how to connect to MySQL Database Service using MySQL Workbench.

This task assumes the following:
  • You have created a Linux Compute Instance to connect to. It is not possible to connect directly from a remote IP to the MySQL DB System endpoint. You must connect to a Compute Instance, and from the Compute Instance to the MySQL DB System.
  • You have configured your network as described in Configuring the Network
For information on MySQL Workbench, see MySQL Workbench User Guide
To connect to MySQL using Workbench:
  1. See TCP/IP over SSH Connection.
  2. Enter the following:
    • SSH Hostname: the public IP address of the Compute Instance.
    • SSH Username: opc
    • SSH Keyfile: path to your SSH private key.
      Note

      MySQL Workbench does not support PuTTy-generated keys. If you used PuTTy to generate your SSH key pair, you must use PuTTygen's Conversion utility to convert your private key to the OpenSSH format for use with MySQL Workbench.
    • MySQL Hostname: the IP address of the MySQL Endpoint.
    • MySQL Server Port: the port the MySQL Endpoint is listening on.
    • Username/Password: credentials you defined when creating the DB System.
  3. Click Test Connection to confirm the connection details are valid.