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
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”
2. Once on the Virtual Cloud Networks page, click “Start VCN Wizard” and select “Create VCN with Internet Connectivity”
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”
4. Once VNC is created, click “View Virtual Cloud Network”
5. Once on the MySQL-VCN page, under “Resources” click “Subnets” and go to the “Private-Subnet-MySQL-VCN”
6. On the Private Subnet page, under “Security Lists”, click on “Security List for Private Subnet-MySQL-VCN” and select “Add Ingress Rules”
7. Enter the below rule information
Step #2: Create SSH Key in OCI using Cloud Shell
1. Navigate to “Cloud Shell” under ‘Developer tools’ next to your Home Region
2. Inside your Cloud Shell, execute the below command to create an SSH key-pair
ssh-keygen -t rsa=
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”
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
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”.
4. Once compute instance is ready. Copy the Public IP address of your Compute instance, then ssh to compute instance from the “Cloud Shell”.
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
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
3. Change the root password using the “ALTER USER” Command
4. Download and install MySQL Shell onto compute instance
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
2. log in to the MySQL instance and check the sample database
Next blog, we will cover performing MySQL shell dump.