Skip to content

MySQL: Migrate MySQL to OCI MySQL HeatWave – Part 1/3

Anas Darkal Jul 13, 2023 10:00:00 AM
MySQL: Migrate MySQL to OCI MySQL HeatWave – Part 1/3 – Eclipsys
3:35

This will be a workshop to show how to migrate MySQL data from MySQL 8 Community Edition running on OCI compute instance to OCI MySQL HeatWave. This will be covered over three blog posts. 

Note: The source MySQL may be running on-premises as well

mysql

In this blog, we will cover installing MySQL 8 Community Edition in Oracle OCI compute instance.

Prerequisites:

  • An Oracle Cloud free trial or paid account

 

Step #1: Create and configure a Virtual Cloud Network (VCN) in OCI

1. Login to OCI. Navigate to “Networking” > “Virtual Cloud Networks”

mysql2

2. Once on the Virtual Cloud Networks page, click “Start VCN Wizard” and select “Create VCN with Internet Connectivity”

mysql3

mysql4

 

3. Name your VCN “MySQL-VCN”. Make sure to pick up the correct compartment                                                      

Leave everything as it is and click “Next”. Review all information and click “Create”

mysql5

 

4. Once VNC is created, click “View Virtual Cloud Network”

mysql6

 

5. Once on the MySQL-VCN page, under “Resources” click “Subnets” and go to the “Private-Subnet-MySQL-VCN”

mysql7

 

6. On the Private Subnet page, under “Security Lists”, click on “Security List for Private Subnet-MySQL-VCN” and select “Add Ingress Rules”

mysql8

mysql9

 

7. Enter the below rule information

mysql10

 

Step #2: Create SSH Key in OCI using Cloud Shell

1. Navigate to “Cloud Shell” under ‘Developer tools’ next to your Home Region

mysql11

 

2. Inside your Cloud Shell, execute the below command to create an SSH key-pair

ssh-keygen -t rsa=

mysql12

 

3. After your public/private rsa key pair has been created, go to the ‘.ssh’ directory and copy the contents of the “id_rsa.pub” file

cd .ssh
cat id_rsa.pub

 

Step #3: Setup a Compute Instance

1. Navigate to “Compute” > “Instances”. Make sure you are in the correct compartment and click “Create instance”

mysql13

 

2. Name your compute instance “MySQL-Compute“. 

For Placement, leave it at default. For Image and shape, make sure “Oracle Linux 8” is selected and choose an appropriate shape that fits your needs. Under Networking, make sure the Public Subnet of your MySQL-VCN is selected

mysql14

mysql15

mysql16

 

3. For the ‘Add SSH keys’, select “Paste public keys” and paste the contents of the id_rsa.pub file here that we copied in step “SSH Key in OCI using Cloud Shell”. After pasting your public key, leave everything default and click “Create”.

mysql17

 

4. Once compute instance is ready. Copy the Public IP address of your Compute instance, then ssh to compute instance from the “Cloud Shell”.

mysql18

mysql19

 

Step #4: Install MySQL 8 Community Edition in OCI Compute Instance

1. Once connected to compute instance, download MySQL Community Edition on the Compute instance by executing the below command

mysql20

 

2. Start the MySQL server after it has been successfully installed onto your Compute instance. Once the server starts, log in to MySQL

Note: during the installation of the MySQL server, it created a root account without a password

mysql21

 

3. Change the root password using the “ALTER USER” Command

mysql22

 

4. Download and install MySQL Shell onto compute instance

mysql23

mysql24

 

Step #5: Load the sample database into the MySQL Database Instance

1. Download the sample ‘world’ database onto your Compute instance, unzip the file, and load it onto the MySQL database instance

Note: additional sample MySQL databases can be found here: https://dev.mysql.com/doc/index-other.html

wget https://downloads.mysql.com/docs/world-db.zipunzip world-db.zip
cd world-db
mysql -u root -p < world.sql

mysql25

 

2. log in to the MySQL instance and check the sample database

mysql26

 

Next blog, we will cover performing MySQL shell dump.

Leave a Comment