If you are thinking about to move your MySQL databases to the Cloud but you are still reticent, you can maybe use the “Oracle Cloud Free Tier” offer to test it.
Oracle Cloud Free Tier offers you 2 Oracle Autonomous Databases and 2 Oracle Cloud Infrastructure Compute VMs as Always Free services and in addition a 30-day Free Trial with US$300 in free credits.
On these VMs instances (provisioned and managed by Oracle Cloud Infrastructure Compute) you can install your MySQL server. Let’s see how…
Oracle Cloud account creation
Connect to the Oracle Cloud page and fill in your credentials:
Define your account type, your Cloud account name, your region and some other details:
Enter your Cloud account password:
Last step is to insert your payment information (this will be just used for verification, you won’t have to pay anything):
And you account will be created:
Instance creation
Some minutes after the account creation, you can sign in to your Oracle Cloud environment:
Once connected, you can directly see that you are in a free trial and you have the possibility to switch to upgrade to paid at any time:
You can now create your VM instance in the “Quick Actions” section in the main page or under “Menu > Compute > Instances > Create Instance”. For example:
You can define the instance name, which image you want to use (Oracle Linux, CentOS, …) as operating system and some other network and storage options:
You also need to define the keys to connect to the VM. If you don’t have them yet, you can generate RSA keys via PuTTYgen for example. You just have to generate the key, assign it a passphrase and save your public and private keys:
You can now add your public key in the “Add SSH keys” section:
and finally launch the instance creation.
The VM creation is in progress in the region that you selected (Zürich in my case):
You can check the status of the operation in the “Work Requests” section:
The instance has been provisioned (it took 2 minutes for me) and it is running now, and you can get the public IP address of the new VM:
Connection to the new VM instance
You can now connect to the new VM via PuTTY, using the given IP address and adding your private key for the authentication in the PuTTY configuration under “Connection > SSH > Auth”:
After entering your passphrase, you are now connected to your VM:
login as: opc Authenticating with public key "rsa-key-20200813" Passphrase for key "rsa-key-20200813": Last login: Fri Aug 14 06:25:38 2020 from 213.55.220.190 [opc@instance-20200730-1509 ~]$
MySQL Server installation
You can now start the installation of MySQL Server.
You have to keep attention to the fact that on Oracle Linux the default RDBMS that will be be installed is MariaDB, and we don’t want that:
$ sudo yum install mysql Loaded plugins: langpacks, ulninfo ol7_UEKR5 | 2.8 kB 00:00:00 ol7_addons | 2.8 kB 00:00:00 ol7_developer | 2.8 kB 00:00:00 ol7_developer_EPEL | 3.4 kB 00:00:00 ol7_ksplice | 2.8 kB 00:00:00 ol7_latest | 3.4 kB 00:00:00 ol7_oci_included | 2.9 kB 00:00:00 ol7_optional_latest | 2.8 kB 00:00:00 ol7_software_collections | 2.8 kB 00:00:00 (1/19): ol7_UEKR5/x86_64/updateinfo | 70 kB 00:00:00 (2/19): ol7_developer/x86_64/primary_db | 560 kB 00:00:00 (3/19): ol7_addons/x86_64/updateinfo | 91 kB 00:00:00 (4/19): ol7_addons/x86_64/primary_db | 157 kB 00:00:00 (5/19): ol7_UEKR5/x86_64/primary_db | 8.4 MB 00:00:00 (6/19): ol7_developer_EPEL/x86_64/group_gz | 87 kB 00:00:00 (7/19): ol7_developer/x86_64/updateinfo | 7.2 kB 00:00:00 (8/19): ol7_latest/x86_64/group_gz | 134 kB 00:00:00 (9/19): ol7_latest/x86_64/updateinfo | 2.9 MB 00:00:00 (10/19): ol7_developer_EPEL/x86_64/updateinfo | 6.3 kB 00:00:00 (11/19): ol7_oci_included/x86_64/primary_db | 260 kB 00:00:00 (12/19): ol7_optional_latest/x86_64/updateinfo | 1.0 MB 00:00:00 (13/19): ol7_developer_EPEL/x86_64/primary_db | 12 MB 00:00:00 (14/19): ol7_software_collections/x86_64/updateinfo | 8.7 kB 00:00:00 (15/19): ol7_software_collections/x86_64/primary_db | 5.1 MB 00:00:00 (16/19): ol7_optional_latest/x86_64/primary_db | 4.8 MB 00:00:00 (17/19): ol7_ksplice/primary_db | 1.0 MB 00:00:01 (18/19): ol7_latest/x86_64/primary_db | 24 MB 00:00:01 (19/19): ol7_ksplice/updateinfo | 5.3 kB 00:00:01 Resolving Dependencies --> Running transaction check ---> Package mariadb.x86_64 1:5.5.65-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================================= Installing: mariadb x86_64 1:5.5.65-1.el7 ol7_latest 8.7 M Transaction Summary ============================================================================================================================================================================================= Install 1 Package Total download size: 8.7 M Installed size: 49 M Is this ok [y/d/N]: N Exiting on user command Your transaction was saved, rerun it with: yum load-transaction /tmp/yum_save_tx.2020-07-30.15-02.2RFWFI.yumtx $ yum list installed | grep -i -e maria mariadb-libs.x86_64 1:5.5.65-1.el7 @anaconda/7.8 $ sudo yum remove mariadb-libs.x86_64 Loaded plugins: langpacks, ulninfo Resolving Dependencies --> Running transaction check ---> Package mariadb-libs.x86_64 1:5.5.65-1.el7 will be erased --> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64 --> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64 --> Running transaction check ---> Package postfix.x86_64 2:2.10.1-9.el7 will be erased --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================================= Removing: mariadb-libs x86_64 1:5.5.65-1.el7 @anaconda/7.8 4.4 M Removing for dependencies: postfix x86_64 2:2.10.1-9.el7 @anaconda/7.8 12 M Transaction Summary ============================================================================================================================================================================================= Remove 1 Package (+1 Dependent package) Installed size: 17 M Is this ok [y/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Erasing : 2:postfix-2.10.1-9.el7.x86_64 1/2 warning: /etc/postfix/main.cf saved as /etc/postfix/main.cf.rpmsave Erasing : 1:mariadb-libs-5.5.65-1.el7.x86_64 2/2 Verifying : 1:mariadb-libs-5.5.65-1.el7.x86_64 1/2 Verifying : 2:postfix-2.10.1-9.el7.x86_64 2/2 Removed: mariadb-libs.x86_64 1:5.5.65-1.el7 Dependency Removed: postfix.x86_64 2:2.10.1-9.el7 Complete!
So you need to specify the exact MySQL packages that you want to install (in my case I will use the MySQL 8.0 Community Edition):
$ sudo yum install https://dev.mysql.com/get/mysql-community-common-8.0.21-1.el7.x86_64.rpm Loaded plugins: langpacks, ulninfo mysql-community-common-8.0.21-1.el7.x86_64.rpm | 617 kB 00:00:00 Examining /var/tmp/yum-root-c8T9EW/mysql-community-common-8.0.21-1.el7.x86_64.rpm: mysql-community-common-8.0.21-1.el7.x86_64 Marking /var/tmp/yum-root-c8T9EW/mysql-community-common-8.0.21-1.el7.x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package mysql-community-common.x86_64 0:8.0.21-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================================= Installing: mysql-community-common x86_64 8.0.21-1.el7 /mysql-community-common-8.0.21-1.el7.x86_64 8.8 M Transaction Summary ============================================================================================================================================================================================= Install 1 Package Total size: 8.8 M Installed size: 8.8 M Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mysql-community-common-8.0.21-1.el7.x86_64 1/1 Verifying : mysql-community-common-8.0.21-1.el7.x86_64 1/1 Installed: mysql-community-common.x86_64 0:8.0.21-1.el7 Complete! $ sudo yum install https://dev.mysql.com/get/mysql-community-libs-8.0.21-1.el7.x86_64.rpm Loaded plugins: langpacks, ulninfo mysql-community-libs-8.0.21-1.el7.x86_64.rpm | 4.5 MB 00:00:00 Examining /var/tmp/yum-root-c8T9EW/mysql-community-libs-8.0.21-1.el7.x86_64.rpm: mysql-community-libs-8.0.21-1.el7.x86_64 Marking /var/tmp/yum-root-c8T9EW/mysql-community-libs-8.0.21-1.el7.x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package mysql-community-libs.x86_64 0:8.0.21-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================================= Installing: mysql-community-libs x86_64 8.0.21-1.el7 /mysql-community-libs-8.0.21-1.el7.x86_64 22 M Transaction Summary ============================================================================================================================================================================================= Install 1 Package Total size: 22 M Installed size: 22 M Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mysql-community-libs-8.0.21-1.el7.x86_64 1/1 Verifying : mysql-community-libs-8.0.21-1.el7.x86_64 1/1 Installed: mysql-community-libs.x86_64 0:8.0.21-1.el7 Complete! $ sudo yum install https://dev.mysql.com/get/mysql-community-client-8.0.21-1.el7.x86_64.rpm Loaded plugins: langpacks, ulninfo mysql-community-client-8.0.21-1.el7.x86_64.rpm | 48 MB 00:00:08 Examining /var/tmp/yum-root-c8T9EW/mysql-community-client-8.0.21-1.el7.x86_64.rpm: mysql-community-client-8.0.21-1.el7.x86_64 Marking /var/tmp/yum-root-c8T9EW/mysql-community-client-8.0.21-1.el7.x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package mysql-community-client.x86_64 0:8.0.21-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================================= Installing: mysql-community-client x86_64 8.0.21-1.el7 /mysql-community-client-8.0.21-1.el7.x86_64 231 M Transaction Summary ============================================================================================================================================================================================= Install 1 Package Total size: 231 M Installed size: 231 M Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mysql-community-client-8.0.21-1.el7.x86_64 1/1 Verifying : mysql-community-client-8.0.21-1.el7.x86_64 1/1 Installed: mysql-community-client.x86_64 0:8.0.21-1.el7 Complete! $ sudo yum install https://dev.mysql.com/get/mysql-community-server-8.0.21-1.el7.x86_64.rpm Loaded plugins: langpacks, ulninfo mysql-community-server-8.0.21-1.el7.x86_64.rpm | 499 MB 00:01:32 Examining /var/tmp/yum-root-c8T9EW/mysql-community-server-8.0.21-1.el7.x86_64.rpm: mysql-community-server-8.0.21-1.el7.x86_64 Marking /var/tmp/yum-root-c8T9EW/mysql-community-server-8.0.21-1.el7.x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package mysql-community-server.x86_64 0:8.0.21-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================================= Installing: mysql-community-server x86_64 8.0.21-1.el7 /mysql-community-server-8.0.21-1.el7.x86_64 2.3 G Transaction Summary ============================================================================================================================================================================================= Install 1 Package Total size: 2.3 G Installed size: 2.3 G Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mysql-community-server-8.0.21-1.el7.x86_64 1/1 Verifying : mysql-community-server-8.0.21-1.el7.x86_64 1/1 Installed: mysql-community-server.x86_64 0:8.0.21-1.el7 Complete! $ sudo yum install https://dev.mysql.com/get/mysql-shell-8.0.21-1.el7.x86_64.rpm Loaded plugins: langpacks, ulninfo mysql-shell-8.0.21-1.el7.x86_64.rpm | 31 MB 00:00:05 Examining /var/tmp/yum-root-c8T9EW/mysql-shell-8.0.21-1.el7.x86_64.rpm: mysql-shell-8.0.21-1.el7.x86_64 Marking /var/tmp/yum-root-c8T9EW/mysql-shell-8.0.21-1.el7.x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package mysql-shell.x86_64 0:8.0.21-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================================= Installing: mysql-shell x86_64 8.0.21-1.el7 /mysql-shell-8.0.21-1.el7.x86_64 106 M Transaction Summary ============================================================================================================================================================================================= Install 1 Package Total size: 106 M Installed size: 106 M Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mysql-shell-8.0.21-1.el7.x86_64 1/1 Verifying : mysql-shell-8.0.21-1.el7.x86_64 1/1 Installed: mysql-shell.x86_64 0:8.0.21-1.el7 Complete!
Packages are now installed and you can start the MySQL Server service:
$ sudo service mysqld start Redirecting to /bin/systemctl start mysqld.service $ ps -eaf|grep mysqld mysql 600 1 12 16:04 ? 00:00:01 /usr/sbin/mysqld opc 656 2746 0 16:04 pts/0 00:00:00 grep --color=auto mysqld
and secure your MySQL installation:
$ sudo grep 'temporary password' /var/log/mysqld.log 2020-07-30T16:04:02.227475Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: -:NQql*u3/IS $ sudo mysql_secure_installation Securing the MySQL server deployment. Enter password for user root: The existing password for the user account root has expired. Please set a new password. New password: Re-enter new password: The 'validate_password' component is installed on the server. The subsequent steps will run with the existing configuration of the component. Using existing password for root. Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : No ... skipping. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y Success. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success. All done!
Everything is fine, you have now access to a MySQL Server on Oracle IaaS:
$ mysqlsh root@localhost --sql Please provide the password for 'root@localhost': ************* Save password for 'root@localhost'? [Y]es/[N]o/Ne[v]er (default No): N MySQL Shell 8.0.21 Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type '\help' or '\?' for help; '\quit' to exit. Creating a session to 'root@localhost' Fetching schema names for autocompletion... Press ^C to stop. Your MySQL connection id is 15 (X protocol) Server version: 8.0.21 MySQL Community Server - GPL No default schema selected; type \use to set one. MySQL localhost:33060+ ssl SQL >
Conclusion
In this blog post we saw how to configure a MySQL Server Community Edition on an Oracle Cloud Infrastructure Compute using the “Oracle Cloud Free Tier” offer. This let you practice with a Cloud environment.
The idea would be, once tested, to switch to the new MySQL Database Service (MDS) built on the latest MySQL 8.0 Enterprise Edition and powered by Oracle Gen 2 Cloud Infrastructure.
I will give you more information soon, so stay tuned as usual and enjoy MySQL 😉
by Elisa Usai