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 configuring the MySQL server.
- Provision OCI compute instance Linux 8.0 x86_64 bits.
- Access to Oracle support portal to download MySQL 8.4.0.
- Prepare private and public ssh keys to the OCI virtual machine
$ sudo yum install -y ncurses-compat-libs
2. Add the below environment variables to the opc user.
export PATH=$PATH:/mysql/mysql-latest/bin
export MYSQL_PS1="\\u on \\h>\\_"
$ vi /home/opc/.bashrc
$ 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
5. Validate the operating system to confirm that it is x86_64 bits.
6. Download the MySQL tar binary from the Oracle support portal and upload it to an OCI storage bucket.
Use wget command to download the tar binary on the virtual machine.
$ sudo wget https://MySQLp36562194_840_Linux-x86-64.zip
$ 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 MySQL configuration file
11. Initialize and start the mysql instance
$ 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
12. Start the MySQL Instance
$ sudo /mysql/mysql8.4.0/bin/mysqld --defaults-file=/mysql/etc/my.6401.cnf --user=mysql &
13. Verify that the mysqld process is running
$ ps -ef|grep mysqld
$ netstat -an | grep 6401
14. Retrieve root password for first login. The temporary password for root is located inside the logfile.
$ cat /mysql/log/mysqld.6401.log or grep -i 'temporary password' /mysql/log/mysqld.6401.log
15. Test connection to the newly installed mysql database.
$ sudo /mysql/mysql8.4.0/bin/mysql -uroot -p -h 127.0.0.1 -P6401
16. Change the root password using the command below and check the status of the database.
mysql> SET PASSWORD=’xxxxxxx';
mysql> status;
No comments:
Post a Comment