Skip links

Connecting to MySQL Database Service – SSH and MySQL Shell

With the Oracle Cloud Infrastructure (OCI) MySQL Database Services, in order to connect you have to access MySQL through a compute node.  This means you will have to create a compute node within OCI.  You can do this quickly with Terraform (here).

Once you have an OCI compute node built, you will need to install MySQL Shell.  MySQL Shell is the advanced MySQL Client for Developers and DBAs.  Making interaction with MySQL easier from the command line.

Installing MySQL Shell

Access the OCI compute node (needs public IP address of compute node)

> ssh -I .ssh/mysql_private_key.pem opc@<public IP address>

mysql-shell-ssh.png

Install MySQL Shell via command line

> sudo yum install -y mysql-shell

mysql-shell-install.png

After MySQL Shell is installed, you can access your MySQL Database Service (database) via the command line.

Connecting to MySQL

To start MySQL Shell and connect to the DB System endpoint, the following command is used.  Keep in mind, you are SSHed into the compute node, from the compute node you’ll use the DB System private IP address to connect.

> mysqlsh [email protected]

mysql-shell-connection.png

Provide the password for the user that was established when creating the MySQL Database Service.

After providing the password, you will be connected to the MySQL Database Service.  By default the MySQL Shell will connect you to the JavaScript command line option.  I’ve switched to the SQL command line option by using “\sql”.

mysql-shell-connected.png

At this point, you can now interact with your MySQL database on Oracle Cloud Infrastructure (OCI).

Leave a comment

  1. Hello! Do you know if they make any plugins to help with SEO?

    I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very
    good success. If you know of any please share. Appreciate it!

    You can read similar blog here: Wool product

  2. I was pretty pleased to uncover this website. I need to to thank you for your time just for this fantastic read!! I definitely savored every little bit of it and I have you bookmarked to check out new stuff on your site.

  3. I was excited to uncover this great site. I need to to thank you for ones time due to this wonderful read!! I definitely liked every bit of it and I have you bookmarked to look at new things on your web site.

  4. I’d like to thank you for the efforts you’ve put in writing this blog. I am hoping to check out the same high-grade blog posts from you later on as well. In fact, your creative writing abilities has motivated me to get my very own site now 😉

  5. Spot i’ll carry on with this write-up, I truly believe this website wants additional consideration. I’ll more likely be once more to see additional, thank you that info.