MySQL is a very popular and powerful Open Source Relational SQL Database Management System. It is being used in a variety of web-based software applications, from simple web applications to running of mission critical transactions. MySQL is being developed and supported by MySQL AB, a Swedish company. In this guide I’ll walk you through the installation of MySQL 8 on Oracle Linux 8.
MySQL is a multi-user, multi-threaded SQL database server that uses a client/server implementation consisting of a server daemon (mysqld) and many different client programs and libraries.
This tutorial will guide you through the installation of MySQL 8.0 on an Oracle Linux 8 server. MySQL 8 ships with new features that you can read in the release notes. The following are the steps you’ll follow to install MySQL 8.0 on Oracle Linux 8.
Install MySQL 8.0 on Oracle Linux 8
Follow the steps below to install, configure, and start MySQL 8.0 on Oracle Linux 8. Since the installation is done from the YUM repository, updating the MySQL database server is an easy process.
Step 1: Update your system
Ensure your system is updated.
sudo yum update
Confirm list of a packages to be updated and hit the y key if you’re okay with it.
....
Transaction Summary
========================================================================================================================================================
Install 3 Packages
Upgrade 17 Packages
Total download size: 92 M
Is this ok [y/N]: y
Reboot your machine:
sudo systemctl reboot
Confirm the current release of Oracle Linux 8 you’re running:
$ cat /etc/oracle-release
Oracle Linux Server release 8.2
Step 2: Install MySQL 8.0 on Oracle Linux 8
MySQL 8.0 package is available on the AppStream repository of the Oracle Linux operating system.
$ sudo dnf module list mysql
Last metadata expiration check: 3:19:45 ago on Wed 30 Oct 2024 09:35:20 PM EAT.
Oracle Linux 8 Application Stream (x86_64)
Name Stream Profiles Summary
mysql 8.0 [d] client, server [d] MySQL Module
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
To Install MySQL 8.0 on Oracle Linux 8 server, run the command below.
sudo dnf install @mysql:8.0
Accept the installation of MySQL 8.0 on Oracle Linux 8.0:
Dependencies resolved.
....
Transaction Summary
========================================================================================================================================================
Install 39 Packages
Total download size: 44 M
Installed size: 249 M
Is this ok [y/N]: y
You can confirm package details.
$ rpm -qi mysql-server
Name : mysql-server
Version : 8.0.40
Release : 3.module+el8.0.0+5253+1dce7bb2
Architecture: x86_64
Install Date: Thu 31 Oct 2024 00:36:33 AM UTC
Group : Unspecified
Size : 144963659
License : GPLv2 with exceptions and LGPLv2 and BSD
Signature : RSA/SHA256, Fri 16 Aug 2023 01:39:42 PM UTC, Key ID 82562ea9ad986da3
Source RPM : mysql-8.0.40-3.module+el8.0.0+5253+1dce7bb2.src.rpm
Build Date : Fri 16 Aug 2023 01:33:41 PM UTC
Build Host : jenkins-10-147-72-125-37856c20-4ffa-4820-bdad-6f8ce19058d8.appad1iad.osdevelopmeniad.oraclevcn.com
Relocations : (not relocatable)
Vendor : Oracle America
URL : http://www.mysql.com
Summary : The MySQL server and related files
Step 3: Configure MySQL 8.0 on Oracle Linux 8
Start and enable mysql daemon service to start at system boot.
sudo systemctl enable --now mysqld
Service status query should return as running.
$ systemctl status mysqld
● mysqld.service - MySQL 8.0 database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2024-10-31 00:40:19 UTC; 25s ago
Process: 6612 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
Process: 6485 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
Process: 6461 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Main PID: 6569 (mysqld)
Status: "Server is operational"
Tasks: 39 (limit: 5047)
Memory: 461.5M
CGroup: /system.slice/mysqld.service
└─6569 /usr/libexec/mysqld --basedir=/usr
Secure Database Server by:
- Setting a secure root user password
- Removing the anonymous users from the database
- Disallow remote login as root user
- Delete test database
Run the command below:
$ sudo mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?
Press y|Y for Yes, any other key for No: y
There are three levels of password validation policy:
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Please set the password for root here.
New password:
Re-enter new password:
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
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!
Test that you can login successfully as root user:
$ mysql -u root -p
Enter password: <Enter-root-user-password>
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.40 Source distribution
Copyright (c) 2000, 2019, 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 '\h' for help. Type '\c' to clear the current input statement.
mysql> QUIT
Bye
You now have a running MySQL 8 database running on Oracle Linux 8 system.
Explore More with CloudSpinx
Looking to streamline your tech stack? At CloudSpinx, we deliver robust solutions tailored to your needs:
- Hosting Services: Web Hosting, VPS, and Email Hosting.
- Development Services: Custom Web & Mobile Apps, UI/UX Design.
- Consultancy Services: Cloud, DevOps, Cybersecurity, and Kubernetes Experts.
- Managed Services: End-to-end infrastructure support.
- Dedicated Servers: Power and control, fully managed.
Learn more about how we can support your journey with CloudSpinx.