Introduction
As organizations increasingly turn to the cloud for scalable, secure, and cost-effective infrastructure, Oracle Cloud Infrastructure (OCI) has emerged as a powerful platform for running high-performance workloads. For developers and DBAs looking to maintain full control over their database environment, deploying MySQL 8.4 on an OCI Compute instance offers the perfect blend of flexibility, performance, and cloud-native capabilities.
In this blog post, I will walk you through the process of setting up MySQL 8.4 on a virtual machine in OCI, covering installation and configuration of the MySQL server.
Pre-requisites
1. Install the the ncurses-compat-libs package on an Oracle Linux 8 Virtual Machine. This package is required when installing MySQL Enterprise Edition using the tar package. This requirement does not apply when using RPM packages for installation.
$ sudo yum install -y ncurses-compat-libs
export PATH=$PATH:/mysql/mysql-latest/bin
export MYSQL_PS1="\\u on \\h>\\_"
$ vi /home/opc/.bashrc
3 Create a new user/group for the MySQL service and add mysql group to opc. Note that login to mysql user is disabled for security reasons.
$ sudo groupadd mysql
$ sudo useradd -r -g mysql -s /bin/false mysql
4 . Create new directory structure:
$ sudo mkdir /mysql/ /mysql/etc/6401 /mysql/data/6401 /mysql/log /mysql/temp /mysql/binlog
$ cd /mysql/binlog
$ mkdir -p replicate/64001 relay/6401
$ sudo chown -R mysql:mysql /MySQL
$ sudo chmod -R 750 /mysql
$ sudo chown -R mysql:mysql /mysql
Use the wget command to download the tar binary on the virtual machine.
$ sudo wget https://MySQLp36562194_840_Linux-x86-64.zip
$ sudo chown MySql :mysql MySQLp36562194_840_Linux-x86-64.zip
8. Unzip the binary file using the command below.
$ sudo unzip MySQLp36562194_840_Linux-x86-64.zip
$ sudo tar -xvf mysql-commercial-8.4.0-linux-glibc2.28-x86_64.tar.xz
$ sudo ln -s mysql-commercial-8.4.0-linux-glibc2.28-x86_64 mysql8.4.0
$ sudo vi /mysql/etc/my.6401.cnf
Below is the content of the MySQL configuration file
$ sudo /mysql/mysql8.4.0/bin/mysqld --defaults-file=/mysql/etc/my.6401.cnf \
--initialize --user=mysql --basedir=/mysql/mysql8.4.0 --datadir=/mysql/data/6401
$ sudo /mysql/mysql8.4.0/bin/mysqld --defaults-file=/mysql/etc/my.6401.cnf --user=mysql &
$ ps -ef|grep mysqld
$ netstat -an | grep 6401
$ cat /mysql/log/mysqld.6401.log or grep -i 'temporary password' /mysql/log/mysqld.6401.log
$ sudo /mysql/mysql8.4.0/bin/mysql -uroot -p -h 127.0.0.1 -P6401
mysql> SET PASSWORD=’xxxxxxx';
mysql> status;
Fill out the form below to unlock access to more Eclipsys blogs – It’s that easy!