Create a MySQL DB System From Oracle Cloud Shell

In this article, we will see how you can create a MySQL DB System from the Oracle Cloud Shell. You can also create MySQL DB System from Oracle Cloud Infrastructure (OCI) console or from OCI Command Line Interface (CLI).

Oracle Cloud Infrastructure (OCI) Cloud Shell is a feature available to all OCI users and accessible from the Console. It is a web browser-based terminal and provides a Linux shell, a pre-authenticated command-line interface (CLI) and preinstalled developer tools like Git, Java, Ansible, and Terraform, for easily managing Oracle Cloud resources. You can run cli commands without any setup. Developers can quickly get started using the Oracle Cloud Infrastructure SDKs, such as the SDK for Python, Java, Go, Ruby, TypeScript and JavaScript without having to download and configure a CLI or Python or other languages on their local machines. To know more about Oracle cloud shell, please look here.

Let’s look at the console below and one can see the Cloud Shell icon shown inside the red colour circle.

Now click on the Cloud Shell icon. It will start creating a shell prompt for you.

Cloud Shell is ready for accepting user commands:

Now let’s create our first MySQL DB System from the Cloud Shell prompt. Let’s discuss the parameters that are mandatory to create a DB System:

--admin-username: name of the administrative user
--admin-password: password of the administrative user
--compartment-id: OCID of the compartment
--shape-name: it determines the resources used to create a DB System i.e CPU cores, memory (RAM)
--subnet-id: OCID of the subnet of the DB System

More information about all the possible parameters for creating a DB System can be found here.
From the Cloud Shell prompt, let’s create the DB System:

Cloudshell> oci mysql db-system create --compartment-id=ocid1.compartment.oc1..aaaaaaaasoye4nili676y7oqgj6pvmzolcgpd7k2ydthbsbmjvfssfulrvfq --admin-username=root --admin-password=Root@321 --subnet-id=ocid1.subnet.oc1.iad.aaaaaaaaejkyd3uahp4qkrwzndbygfohgyehjcermhoivp2kujxhshecrzoa --endpoint= --display-name=user1-cloud-shell-300122 –availability-domain=LqKe:US-ASHBURN-AD-1

From the above image, we can see that shape name is missing. So let’s add shape name (--shape-name=MySQL.VM.Standard.E3.1.8GB) to the create command and rerun.

Cloudshell> oci mysql db-system create --compartment-id=ocid1.compartment.oc1..aaaaaaaasoye4nili676y7oqgj6pvmzolcgpd7k2ydthbsbmjvfssfulrvfq --admin-username=root --admin-password=Root@321 --subnet-id=ocid1.subnet.oc1.iad.aaaaaaaaejkyd3uahp4qkrwzndbygfohgyehjcermhoivp2kujxhshecrzoa --shape-name=MySQL.VM.Standard.E3.1.8GB –data-storage-size-in-gbs=50 --endpoint= --display-name=user1-cloud-shell-300122 –availability-domain=LqKe:US-ASHBURN-AD-1

The idea is to show that a proper error message will display if we missed any required parameter while creating the DB System.

From the above image, we can see that DB System state (lifecycle-state) is “CREATING” i.e. in the process of creating.

To check the state of the DB System, we can issue ‘get’ option to the db-system command along with db-system-id.

Cloudshell> oci mysql db-system get --db-system-id=ocid1.mysqldbsystem.oc1.iad.aaaaaaaae4t7vb7lw6c7netvzqb446x3qd4jzf2lcf46fjtxv2tg5wjuhysa --endpoint=

From the above image, we can see that DB System lifecycle state is “ACTIVE” now i.e. DB System has been created successfully.
We can also view the DB System details from the Console as well:

Clicking on the DB System that will show you the list of each DB System created with its state.

In our case, we can see that ‘user1-cloud-shell-300122’ is already created. This is the name that we have passed through parameter ‘--display-name’ while creating the DB System.

From the above image, we can see that Service State of the DB System is “Active”. We can also get the details of MySQL instance from the same Console too.

From the above image, we can see MySQL Instance details like Private IP address (it is the IP address to which you can connect to the MySQL instance), MySQL port, MySQL version, storage size etc.

So in this article we saw how easy it is to create a MySQL DB System from Cloud Shell. With this I conclude our discussion here.


Popular posts from this blog

MySQL NDB Cluster Backup & Restore In An Easy Way

MySQL Cluster Self Healing And No Single Point Of Failure Feature

MySQL NDB Cluster Installation Through Docker