• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Monday, May 12, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to Set Up a MySQL Database Server on Oracle Linux

in Linux OS, Oracle Linux
How to Set Up a MySQL Database Server on Oracle Linux

MySQL is one of the most popular open-source relational database management systems (RDBMS). In this comprehensive guide, we will walk you through the process of how to set up a MySQL database server on Oracle Linux. Oracle Linux is a great choice for running MySQL, as it provides a stable and secure environment, as well as excellent performance. Let’s dive in!

Table of Contents

  1. Prerequisites
  2. Installing MySQL
  3. Configuring MySQL
  4. Securing MySQL
  5. Managing MySQL Services
  6. Creating and Managing MySQL Databases
  7. Conclusion

Prerequisites

Before we begin, ensure that you have:

  1. Oracle Linux 7 or 8 is installed on your server.
  2. A user account with sudo privileges.
  3. A stable internet connection.

How to Set Up a MySQL Database Server on Oracle Linux

Installing MySQL

First, let’s update the system packages and install any necessary dependencies:

sudo yum update -y
sudo yum install -y wget

Next, download the MySQL Yum repository:

wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

Install the repository using yum:

sudo yum localinstall mysql80-community-release-el7-3.noarch.rpm

Now, install MySQL:

sudo yum install -y mysql-community-server

Once the installation is complete, start the MySQL service and enable it to start at boot:

sudo systemctl start mysqld
sudo systemctl enable mysqld

Configuring MySQL

After installing MySQL, you must configure it for optimal performance and security. First, let’s retrieve the default root password:

sudo grep 'temporary password' /var/log/mysqld.log

Take note of the password, as you’ll need it to log in to MySQL in the next step. Now, log in to MySQL:

mysql -u root -p

Enter the temporary password when prompted. Once logged in, change the root password:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewSecurePassword';

Replace NewSecurePassword with a strong password of your choice.

Securing MySQL

Next, run the MySQL security script to secure your installation further:

sudo mysql_secure_installation

This script will prompt you to:

  • Change the root password (you can skip this since you’ve already done it)
  • Remove anonymous users
  • Disallow remote root login
  • Remove the test database and access to it
  • Reload privilege tables

Follow the prompts and answer accordingly to enhance the security of your MySQL installation.

Managing MySQL Services

To ensure that your MySQL server is running smoothly, it’s essential to know how to manage its services. Here are some basic commands:

Start MySQL:

sudo systemctl start mysqld

Stop MySQL:

sudo systemctl stop mysqld

Restart MySQL:

sudo systemctl restart mysqld

Check MySQL status:

sudo systemctl status mysqld

These commands will help you maintain control over your MySQL server and troubleshoot any issues that may arise.

Creating and Managing MySQL Databases

Now that your MySQL server is set up, it’s time to create and manage databases. Log in to MySQL using your root account:

mysql -u root -p

Enter your root password when prompted. To create a new database, run the following command, replacing my_database with your desired database name:

CREATE DATABASE my_database;

View a list of all databases, execute:

SHOW DATABASES;

To create a new user and grant them privileges on the newly created database, run the following commands, replacing my_user, my_password, and my_database with your desired values:

CREATE USER 'my_user'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON my_database.* TO 'my_user'@'localhost';
FLUSH PRIVILEGES;

Now, your new user has full access to the specified database. To switch to a different database, use the USE command:

USE my_database;

From here, you can create tables, insert data, and perform various operations within the selected database.

Conclusion

Congratulations! You’ve successfully set up a MySQL database server on Oracle Linux. With your new MySQL server, you can create and manage databases, users, and access privileges to support various applications and services.

To further enhance your Oracle Linux server, consider installing additional software such as NGINX, Apache, or Python. Additionally, explore our tutorials on how to set up RAID 1 in Ubuntu and how to install TensorFlow on Oracle Linux for more advanced configurations and optimizations.

We hope this guide has provided you with a solid foundation for setting up and managing a MySQL database server on Oracle Linux. Happy database administration!

ShareTweet
Previous Post

How to Install TensorFlow on Oracle Linux

Next Post

How to Install MariaDB Server on Oracle Linux

Related Posts

How to Install Tomcat on Rocky Linux

How to Install Apache Tomcat on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.